Sample code for 30+ languages & platforms
Tcl

SSH Key Fingerprint

See more SSH Key Examples

Generates a fingerprint for an SSH key.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

set key [new_CkSshKey]

# Load an SSH key from an encrypted OpenSSH-formatted private key:
CkSshKey_put_Password $key "secret"

# First load the PEM into a string:
set keyStr [CkSshKey_loadText $key "privkey_openssh_encrypted.pem"]

# Import into the SSH key object:
set success [CkSshKey_FromOpenSshPrivateKey $key $keyStr]
if {$success != 1} then {
    puts [CkSshKey_lastErrorText $key]
    delete_CkSshKey $key
    exit
}

# Generate the fingerprint:

set fingerprint [CkSshKey_genFingerprint $key]

puts "$fingerprint"

# A sample fingerpring looks like this:
# ssh-dss 2048 d0:5f:f7:d6:49:60:7b:50:19:f4:41:59:d4:1f:61:7

delete_CkSshKey $key