开发者

What's the characterset of SHA1?

开发者 https://www.devze.com 2023-03-07 00:52 出处:网络
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 confi开发者_如何学Cgurable, what\'s the default characterset of it?

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 confi开发者_如何学Cgurable, what's the default characterset of it?

Thank you.


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.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消