Вопрос

I am working on writing a SHA512 function. When i check the file I am encrypting on different sources, a Linux SHA512SUM tool, a couple websites, and run it through the old source code i have for SHA512, they all give different hash values. My thought going into this project is that all Hash algorithms will output the same hash value if implemented correctly, to be used as a check sum. Am I wrong in thinking this? If I am wrong how would I really check to see if my work is correct?

Thanks in advance.

Это было полезно?

Решение

Yes, that's one of the basic building block of PKI: the same data block passed to a hash should always return the same hash value.

beware of the interpretation, though: the result of a SHA-2(512) hash is a block of 512 bits, not a string value so it will first be encoded for human consumption and it is therefore possible that you see what looks like visually different results when it's simply a matter of using different encodings.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top