Skip to contents

Calculates the OpenSSH fingerprint of a public key. This value should match what you get to see when connecting with SSH to a server. Note that some other systems might use a different algorithm to derive a (different) fingerprint for the same keypair.

Usage

fingerprint(key, hashfun = sha256)

Arguments

key

a public or private key

hashfun

which hash function to use to calculate the fingerprint

Examples

mykey <- rsa_keygen()
pubkey <- as.list(mykey)$pubkey
fingerprint(mykey)
#> sha256 b5:64:02:51:09:1c:78:a7:00:c3:8c:77:32:ae:87:a0:3b:93:37:24:17:74:a1:39:42:0d:a3:61:7c:ea:cd:91 
fingerprint(pubkey)
#> sha256 b5:64:02:51:09:1c:78:a7:00:c3:8c:77:32:ae:87:a0:3b:93:37:24:17:74:a1:39:42:0d:a3:61:7c:ea:cd:91 

# Some systems use other hash functions
fingerprint(pubkey, sha1)
#> sha1 ca:00:08:0a:08:d6:d6:a3:52:f6:55:46:cd:1f:fd:3b:5e:d5:5a:24 
fingerprint(pubkey, sha256)
#> sha256 b5:64:02:51:09:1c:78:a7:00:c3:8c:77:32:ae:87:a0:3b:93:37:24:17:74:a1:39:42:0d:a3:61:7c:ea:cd:91 

# Other key types
fingerprint(dsa_keygen())
#> sha256 44:80:fd:db:fb:91:40:b1:f0:b0:1c:76:15:66:52:30:ca:e8:1c:ed:e2:fb:2b:13:3b:f9:c0:2a:6a:ec:8c:e4