Why is a SHA-1 Hash 40 characters long if it is only 160 bit?

后端 未结 6 477
自闭症患者
自闭症患者 2020-12-23 10:00

The title of the question says it all. I have been researching SHA-1 and most places I see it being 40 Hex Characters long which to me is 640bit. Could it not be represented

6条回答
  •  一整个雨季
    2020-12-23 10:12

    There are two hex characters per 8-bit-byte, not two bytes per hex character.

    If you are working with 8-bit bytes (as in the SHA-1 definition), then a hex character encodes a single high or low 4-bit nibble within a byte. So it takes two such characters for a full byte.

提交回复
热议问题