How do I generate a SHA-256 hash in base64 format from commandline? I want a piped commands kind of solution.
Asked
Active
Viewed 4,817 times
2 Answers
3
I suggest the following piped command:
printf InputKey | sha256sum | cut -d ' ' -f 1 | xxd -r -p | base64
Michael Fayad
- 151
0
The alternative solution is using openssl and a bit shorter:
echo -n InputKey | openssl sha256 -binary | base64 -
miklosq
- 91