MD5 hash with different results

前端 未结 4 451

Im trying to encode some chains to MD5 but I have noticed that:

For the chain: \"123456çñ\"

Some webs like

http://www.md5.net

www.md5.cz

4条回答
  •  孤城傲影
    2020-12-05 19:23

    The problem I guess is in different text encodings. The string you show can't be represented in ANSI encoding - it requires UTF-16 or UTF-8. The choice of one of the latter leads to different byte representation of the string and that produces different hashes.

    Remember, MD5 hashes bytes, not characters - it's up to you how to encode those characters as bytes before feeding bytes to MD5. If you want to interoperate with other systems you have to use the same encoding as those systems.

提交回复
热议问题