Take the 2-minute tour ×

I need to know what character will the SHA1 will generate for me?

Is it possible to know the characterset of the SHA1? Or if it's configurable, what's the default characterset of it?

Thank you.

share|improve this question
SHA1 is 20 binary bytes... are you asking for a way to represent it? –  alpian May 20 '11 at 8:09
It's a hex number with digits 0-9 A-F, what charset would be involved there? –  N.B. May 20 '11 at 8:10
@N.B.: you know that there are charsets that represent those differently? EBCDIC is the cannonical example, but a modern one would be UTF-16, for example. Not everything is ASCII, not even in this range. –  Joachim Sauer May 20 '11 at 10:51

3 Answers 3

up vote 2 down vote accepted

I'm fairly sure it's just binary data rather than any character encoding. You could then encode that in Base64 if you like.

share|improve this answer

SHA-1 doesn't generate text, it generates a binary hash (like most digests), so it doesn't have a charset (or care about the input's charset for that matter).

You can represent it as text (a string representation of the hex value, and base64 are popular) if you want, especially if you need to transfer it over the network or display it to users. That encoding is up to you.

share|improve this answer

The hash algorithm SHA1 takes a stream of bytes as input, and calculates the 160-bits digest. Command line versions output the digest as a hexadecimal string. No charsets involved.

share|improve this answer
SHA-1 produces 160 bit output, not "a hexadecimal string". That output can (and often is) formatted as a hexadecimal number, but that's not specified in SHA-1. –  Joachim Sauer May 20 '11 at 8:20
I've clarified the distinction between the algorithm and utilities that output the digest. –  ShiDoiSi May 20 '11 at 10:23

Your Answer


