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 fd:3b:03:b3:41:67:b5:34:88:eb:49:b6:e2:55:68:cb:e8:af:31:01:b0:0a:52:c4:15:c4:0f:f1:62:ea:2a:e3 
fingerprint(pubkey)
#> sha256 fd:3b:03:b3:41:67:b5:34:88:eb:49:b6:e2:55:68:cb:e8:af:31:01:b0:0a:52:c4:15:c4:0f:f1:62:ea:2a:e3 

# Some systems use other hash functions
fingerprint(pubkey, sha1)
#> sha1 b6:8a:54:44:5a:4c:b8:7b:fa:e9:ab:9c:07:75:70:ce:1e:14:88:93 
fingerprint(pubkey, sha256)
#> sha256 fd:3b:03:b3:41:67:b5:34:88:eb:49:b6:e2:55:68:cb:e8:af:31:01:b0:0a:52:c4:15:c4:0f:f1:62:ea:2a:e3 

# Other key types
fingerprint(dsa_keygen())
#> sha256 19:4e:9d:b8:c6:27:60:0b:f5:61:b4:07:69:52:39:9f:6f:cc:75:b8:f8:e1:5c:0f:67:55:0d:5d:00:4d:65:97