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 c0:4d:6e:d1:10:0a:46:87:ce:10:ee:4c:cb:29:3c:08:5a:e9:f5:b3:7a:90:bd:ba:0e:94:4b:2e:57:e8:50:a9 
fingerprint(pubkey)
#> sha256 c0:4d:6e:d1:10:0a:46:87:ce:10:ee:4c:cb:29:3c:08:5a:e9:f5:b3:7a:90:bd:ba:0e:94:4b:2e:57:e8:50:a9 

# Some systems use other hash functions
fingerprint(pubkey, sha1)
#> sha1 1f:3f:8c:f0:52:4c:fe:f7:d5:9c:0a:dc:76:ae:8b:ca:88:dd:96:e6 
fingerprint(pubkey, sha256)
#> sha256 c0:4d:6e:d1:10:0a:46:87:ce:10:ee:4c:cb:29:3c:08:5a:e9:f5:b3:7a:90:bd:ba:0e:94:4b:2e:57:e8:50:a9 

# Other key types
fingerprint(dsa_keygen())
#> sha256 67:07:97:2d:aa:66:f4:8d:e2:5d:6a:59:ca:36:5e:5b:25:28:a1:a0:83:a0:a1:10:2a:ea:e1:78:ca:18:b3:3c