Jump to content

CRYPT_SHA512 is generating same hash value for multiple inputs


Jagand
Go to solution Solved by requinix,

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); 
Link to comment
Share on other sites

  • Solution

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.