Search code examples
encryptioncryptographypublic-key-encryption

is SHA512 with 256 bits set to zero equivalent to SHA256?


I'm doing my first steps in cryptography.

i'm trying to understand why sha512 with 256 bits set to zero, is not equal to sha256? there is some similarity between sha512 with 256 bits set to zero and sha256?


Solution

  • While SHA-512 and SHA-256 have similar structure, they use different block length, internal state size, number of rounds and initial hash values.

    Therefore, although the computations are the same, the output is very different, even if you provide similar input (such as 256 zero bits). Additionally the output of SHA-512 is 512 bits whereas SHA-256 provides 256 bits of output; so no, SHA-512 is not the same as SHA-256.