Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
convert hex string to base64 string and viceversa
# convert hex string to base64 string
| xxd -r -p | base64
# convert base64 string to hex string
| base64 -d | od -t x1 -An
# Example: the whole circle in one command
# convert base64 to binary, to sha256 checksum (string in hex format), to decoded hex data (xxd -r),
# to base64 string, to base64 decoded data (base64 -d), back to hex string
awk '{print $2}' /etc/ssh/ssh_host_ecdsa_key.pub | base64 -d | sha256sum -b | awk '{print $1}' | xxd -r -p | base64 | base64 -d | od -t x1 -An
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.