webref.eu Posted February 22, 2009 Share Posted February 22, 2009 Hi All Please could you explain to me what this line of code does, i.e. translate the code into English please: $AuthCode = md5(rand(0,55)."{$password}{$username}"); Many thanks Link to comment https://forums.phpfreaks.com/topic/146384-solved-tell-me-what-this-line-does-please/ Share on other sites More sharing options...
Mchl Posted February 22, 2009 Share Posted February 22, 2009 Assign to a variable called $AuthCode an output of md5 function, whose argument is a random number from 0 to 55 followed by a $password and a $username variables. Link to comment https://forums.phpfreaks.com/topic/146384-solved-tell-me-what-this-line-does-please/#findComment-768583 Share on other sites More sharing options...
webref.eu Posted February 22, 2009 Author Share Posted February 22, 2009 OK thanks, that's what I thought ... The reason I asked is because I had noticed in testing the same AuthCode cropping up every now and again, which clearly should not have been happening. I have now realised the problem was that I had a case sensitivity issue, i.e. I should have been using $Password and not $password. Thanks for your help. Link to comment https://forums.phpfreaks.com/topic/146384-solved-tell-me-what-this-line-does-please/#findComment-768604 Share on other sites More sharing options...
webref.eu Posted March 7, 2009 Author Share Posted March 7, 2009 Am I right in saying that provided whatever I provide to the md5 function is unique, the resulting md5 hash will be unique? i.e. it is impossible for the same md5 hash to be produced from two different input strings? Thanks Link to comment https://forums.phpfreaks.com/topic/146384-solved-tell-me-what-this-line-does-please/#findComment-779104 Share on other sites More sharing options...
Mchl Posted March 7, 2009 Share Posted March 7, 2009 You are not right. MD5 is not collision-resistant. With computing power available today it's relatively easy to find two strings that result in same hash. See http://www.win.tue.nl/hashclash/Nostradamus/ for an impressive example. Link to comment https://forums.phpfreaks.com/topic/146384-solved-tell-me-what-this-line-does-please/#findComment-779118 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.