Skip to content

Instantly share code, notes, and snippets.

@redmcg
Last active August 25, 2020 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redmcg/d419b36e1280bd71a48c594f1666fcc9 to your computer and use it in GitHub Desktop.
Save redmcg/d419b36e1280bd71a48c594f1666fcc9 to your computer and use it in GitHub Desktop.
Given a base64 public SSH key, output fingerprint
#!/usr/bin/env bash
echo $1 | base64 -d | md5sum | sed 's/../&:/g;s/: .*$//;s/.*/MD5:&/'
echo $1 | base64 -d | sha256sum | xxd -r -p | base64 | sed 's/=*$//;s/.*/SHA256:&/'
@redmcg
Copy link
Author

redmcg commented Aug 25, 2020

If you only have a private key, you can create the public key with:
ssh-keygen -y -f <private_key>

The SSHFP can also be seen with:
ssh-keygen -lf <public_key>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment