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