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 9c:07:e4:58:38:3f:ab:2d:73:cf:41:39:1f:c7:6c:82:d2:55:13:22:3e:38:74:db:13:84:95:d6:c1:3e:12:ec 
fingerprint(pubkey)
#> sha256 9c:07:e4:58:38:3f:ab:2d:73:cf:41:39:1f:c7:6c:82:d2:55:13:22:3e:38:74:db:13:84:95:d6:c1:3e:12:ec 

# Some systems use other hash functions
fingerprint(pubkey, sha1)
#> sha1 cf:8c:60:91:38:ff:3d:0c:23:ec:ed:5c:67:db:ea:24:c6:c2:54:82 
fingerprint(pubkey, sha256)
#> sha256 9c:07:e4:58:38:3f:ab:2d:73:cf:41:39:1f:c7:6c:82:d2:55:13:22:3e:38:74:db:13:84:95:d6:c1:3e:12:ec 

# Other key types
fingerprint(dsa_keygen())
#> sha256 8a:2d:7f:ee:f7:71:56:f4:de:2e:ed:00:24:14:63:88:ee:83:41:e1:d5:af:26:99:c6:9c:30:16:b7:f0:b2:5f