diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2025-04-11 15:02:18 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2025-04-11 15:02:18 -0400 |
| commit | 8b3f56a419eb6f3d8c0d711e5f35bae5fcfc534e (patch) | |
| tree | f1c1e01c66ea937c59f189258d4d9e003f6960a7 | |
| parent | bfa33110dfb4018325b9fbb3089b2e85b9bc0124 (diff) | |
| download | hose-8b3f56a419eb6f3d8c0d711e5f35bae5fcfc534e.zip | |
fingerprint
| -rw-r--r-- | fingerprint.go | 7 | ||||
| -rw-r--r-- | handshake.go | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/fingerprint.go b/fingerprint.go new file mode 100644 index 0000000..9812114 --- /dev/null +++ b/fingerprint.go @@ -0,0 +1,7 @@ +package main + +import "crypto/sha256" + +func fingerprint(key []byte) []byte { + return sha256.New().Sum(key) +} diff --git a/handshake.go b/handshake.go index cfe7085..2cedaad 100644 --- a/handshake.go +++ b/handshake.go @@ -96,7 +96,7 @@ func verifyPublicKey(addr net.Addr, pubkey [32]byte) (bool, error) { // Ask host to verify fingerprint. logf("Fingerprint of host %q: %s\nIs this the correct fingerprint (yes/[no])?", - hostname, fingerprint(pubkey)) + hostname, fingerprint(pubkey[:])) var response string n, err := fmt.Scanln(&response) if err != nil { |