Base64 encoding of a SHA256 hash

You are doing a conversion from hex encoding (or base16 if you like) to base64. So you are base64 encoding the ASCII characters 9 (57), B (66) and 2 (50) giving you OUIy.

What you should be doing is base64 encoding the raw bytes. So you should encode 0x9B (155) and 0x23 (35) giving you myM.


This should do;

echo 9B2317C2C941A179130D0D28961AB542C88745658BE328F557422EA0AF8F60E8 | xxd -r -p | base64

Output:

myMXwslBoXkTDQ0olhq1QsiHRWWL4yj1V0IuoK+PYOg=

Tags:

Hash

Sha256

Jwt