Skip to content

Function: sha256Fingerprint() ​

ts
function sha256Fingerprint(bytes): string;

Defined in: netconf/src/transport/fingerprint.ts:22

The OpenSSH-style SHA-256 fingerprint of some bytes: SHA256: then the base64 digest without its = padding, as ssh-keygen -lf prints it. For an SSH host key, pass the public key blob in SSH wire format; for a TLS certificate, its DER. The result is what the hostKey policy and the TLS fingerprint pin accept.

Parameters ​

bytes ​

Uint8Array

Returns ​

string

Example ​

ts
sha256Fingerprint(new TextEncoder().encode('abc'));
// 'SHA256:ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0'

Released under the MIT Licence.