Jagand Posted April 13, 2013 Share Posted April 13, 2013 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); Quote Link to comment https://forums.phpfreaks.com/topic/276918-crypt_sha512-is-generating-same-hash-value-for-multiple-inputs/ Share on other sites More sharing options...
DavidAM Posted April 13, 2013 Share Posted April 13, 2013 Why are you crypting a crypt of a crypt? This is NOT more secure and, in fact, increases the chances of a collision. Quote Link to comment https://forums.phpfreaks.com/topic/276918-crypt_sha512-is-generating-same-hash-value-for-multiple-inputs/#findComment-1424614 Share on other sites More sharing options...
Jagand Posted April 13, 2013 Author Share Posted April 13, 2013 I am getting same issue even with one level of crypt.. Quote Link to comment https://forums.phpfreaks.com/topic/276918-crypt_sha512-is-generating-same-hash-value-for-multiple-inputs/#findComment-1424617 Share on other sites More sharing options...
Solution requinix Posted April 13, 2013 Solution Share Posted April 13, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/276918-crypt_sha512-is-generating-same-hash-value-for-multiple-inputs/#findComment-1424618 Share on other sites More sharing options...
Jagand Posted April 14, 2013 Author Share Posted April 14, 2013 Thank you. That solves the problem Quote Link to comment https://forums.phpfreaks.com/topic/276918-crypt_sha512-is-generating-same-hash-value-for-multiple-inputs/#findComment-1424623 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.