1

64 characters are used to render a SHA256 hash. Why isn't it 32 since 256 divided by 8 is 32? Is the byte a raw byte that needs to be base64 encoded to be represented as ascii characters?

  • Possible duplicate of [Will a SHA256 hash always have 64 characters?](http://stackoverflow.com/questions/3064133/will-a-sha256-hash-always-have-64-characters) – wkl Apr 05 '17 at 06:39

1 Answers1

0

Yes. Byte values 128-255 are not part of any ASCII code units. ASCII has only 128 codepoints so it can't cover all 256 byte values no matter what the mapping is.

But the real reason for using Base16 is so that all the characters are printable/visible and none of them are control characters (regardless of the character set and encoding) or quote characters used as literal string delimeters in programming languages and document formats. This lets them pass through many contexts as is, without breaking any rules of the context.

There are other ways of achieving that goal. One is Base64.

Tom Blodget
  • 20,260
  • 3
  • 39
  • 72