2013-12-26 12:33 keltezéssel, Kende Krisztián írta:
> Hi,
>
> 'gb.crypt' component is perfect if I want to check SHA-512 password match:
>
>     Dim shahash As String
>
>     Exec ["mkpasswd", "-m", "sha-512", "alma"] To shahash
>
>     Print Crypt.Check("alma", Trim(shahash))
>
> Output is 'False', so the password is correct.
>
> But SHA-512 hash generating function isn't implemented yet, just
> simplified MD5. Can't we do something about it?
>
> Kendek
>
>

I'm not a C programmer, but I hacked the 'gb.crypt' source ('c_crypt.c'):

- strcpy(key, "$1$");
+ strcpy(key, "$6$");

I compiled this:

./reconf
./configure
make

and I installed the created 'gb.crypt.so.0.0.0'.

The result:

   Exec ["mkpasswd", "-m", "sha-512", "alma", "almaalma"]

   Print Crypt.MD5("alma", "almaalma")

Output:

$6$almaalma$MWWhHTP9sVVxJ1olWCRidzfMOSH0nOKVR9cjcHCtqP5LQ/08V18jiwakTNxWSNUWMyIE2lVLKBL.MUBTk460T.
$6$almaalma$MWWhHTP9sVVxJ1olWCRidzfMOSH0nOKVR9cjcHCtqP5LQ/08V18jiwakTNxWSNUWMyIE2lVLKBL.MUBTk460T.

So this method is works, the generated hash is a SHA-512 hash.
Please implement this little plus function, really don't seem too 
difficult. :-)

Kendek


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to