Can an md5 hash string be different in one place?

Possible duplicate:
Will the output of the MD5 hash function be the same in all programming languages?

Hello,

I have a problem with md5 hashing. Users can upload picures profiles to my project. I am using md5 for the name of the profile name. But there is something interesting. I haveh the value with both the test page on my server and with md5, encrypting sites with the same result. When I use this encryption to rename an image, it creates something else. It creates various value for image processing file.

Do you have any ideas?

This is my check script:

<?php echo md5('funky'); ?> 

It outputs below code on my server as well as on md5encrypter.com:

 6b818a3a6bf1234ed24c940021922b63 

But it does manipulations with images below the code on my file. I do not know what it is:

 d41d8cd98f00b204e9800998ecf8427e 

Script for sql query. $ userId comes from entering userId:

 $sql = mysql_query("SELECT username FROM users WHERE userId='$userId'"); while($row=mysql_fetch_assoc($sql)){ $username=$row['username']; } 
+4
source share
2 answers

d41d8cd98f00b204e9800998ecf8427e is an MD5 hash of an empty string, so somewhere you couldnโ€™t fill your string with something more useful ...

MD5 will always output the same output for a given input, otherwise it is not MD5. What I did was just google for the hash that you had and it got a lot of hits. If I didnโ€™t hit the hit, I would look for some of the inverse MD5 dictionaries that are around to see if this gave some clues.

Luckily, your hash is simply the result of MD5('') , very common. This clearly indicates that you tried to get something from your database, failed, and hashed anyway.

+6
source

make 100% sure that you standardize the input everywhere, as in $enc_md5=md5(trim(strtolower($filename)));

Often, unintentional spaces or capitalization results in different MD5 hashes for assumed identical data.

+2
source

Source: https://habr.com/ru/post/1332401/


All Articles