Jump to content

CRYPT_SHA512 is generating same hash value for multiple inputs


Jagand

Recommended Posts

Hi,

 

I see that when I am applying crypt function on the text 'samurai.ciscorouter1', output is same as it is for 'samurai.ciscorouter2'. Is the code I am giving how it must be?

print "<hr/>" .crypt(crypt(crypt('samurai.ciscorouter1',CRYPT_SHA512), CRYPT_SHA512), 
CRYPT_SHA512); 

print "<hr/>" .crypt(crypt(crypt('samurai.ciscorouter2',CRYPT_SHA512), CRYPT_SHA512), 
CRYPT_SHA512); 

You're not using crypt() correctly. The second argument is not a "mode". You don't pass in constants like CRYPT_SHA512. In fact those constants only tell you whether there is support for that type of hash.

 

RTFM

print "<hr/>" . crypt('samurai.ciscorouter1', '$6$a16charactersalt');
print "<hr/>" . crypt('samurai.ciscorouter2', '$6$a16charactersalt');
<hr/>$6$a16charactersalt$blQiCNs8hARJgK03F1aaOKeoY1onl6GvJrBkcf2VD03jvIRnHh2jvt47YCPRRaLHGReaDOGOCkuNwQoXKikr2/
<hr/>$6$a16charactersalt$e7lkgunJmMxBX.fokhsuhUIrxmJM.WuiWW6dMmzwK6JqQg9M10amQr3U9SMtQp6L5hqKev7k21bViDuSSkgDc1

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.