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.

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 11:2c:4e:82:dc:e1:1e:06:44:2b:e9:f7:c8:96:c0:aa:a1:6d:43:af:ad:b2:8e:f1:ed:6c:0d:e9:76:67:2a:d7 
fingerprint(pubkey)
#> sha256 11:2c:4e:82:dc:e1:1e:06:44:2b:e9:f7:c8:96:c0:aa:a1:6d:43:af:ad:b2:8e:f1:ed:6c:0d:e9:76:67:2a:d7 

# Some systems use other hash functions
fingerprint(pubkey, sha1)
#> sha1 19:88:31:4d:72:a3:84:39:bc:d1:24:8c:79:6e:4e:e8:76:2f:7d:7f 
fingerprint(pubkey, sha256)
#> sha256 11:2c:4e:82:dc:e1:1e:06:44:2b:e9:f7:c8:96:c0:aa:a1:6d:43:af:ad:b2:8e:f1:ed:6c:0d:e9:76:67:2a:d7 

# Other key types
fingerprint(dsa_keygen())
#> sha256 c7:2f:c1:d8:b7:b1:5c:bf:5a:78:39:57:b1:fb:e2:42:4c:89:1d:15:99:25:ae:82:2d:90:92:18:ea:db:77:30