An SSH public key in OpenSSH format contains two or three parts, separated by spaces:
- The algorithm name.
- A base64-encoded SSH public key in protocol format.
- An optional comment.
The fingerprint of an SSH key is the base64-encoded SHA-256 hash of the raw public key (that is, without the base64 encoding). You can script this, but fortunately, there's an easy way to find it out using ssh-keygen:
$ ssh-keygen -l -f ~/.ssh/id_ed25519.pub
You can change the file name for the public key to the appropriate one on your system. On my system, the output looks like this:
256 SHA256:E59Xzh/fsZKkCEL46kTLbPFGXyIodA+ntsQL0JWmq9Y bmc@camp (ED25519)
The fingerprint is the second piece.