💯 SSH Fingerprint in a lightweight, zero-dependency VanillaJS node library.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
AJ ONeal bf95bbb91c v1.0.0: generate ssh-keygen compatible fingerprints 5 years ago
bin v1.0.0: generate ssh-keygen compatible fingerprints 5 years ago
fixtures v1.0.0: generate ssh-keygen compatible fingerprints 5 years ago
lib v1.0.0: generate ssh-keygen compatible fingerprints 5 years ago
README.md v1.0.0: generate ssh-keygen compatible fingerprints 5 years ago
index.js v1.0.0: generate ssh-keygen compatible fingerprints 5 years ago
package.json v1.0.0: generate ssh-keygen compatible fingerprints 5 years ago
test.sh v1.0.0: generate ssh-keygen compatible fingerprints 5 years ago

README.md

SSH Fingerprint (for node.js)

A minimal library to read an SSH public key (id_rsa.pub) and generate its fingerprint.

Works for RSA and ECDSA public keys.

Features

< 100 lines of code | <1kb gzipped | 1.8kb minified | 3.1kb with comments

  • SSH Public Key SHA256 Fingerprints
    • RSA (2048-bit, 3072-bit, 4096-bit)
    • EC / ECDSA
      • P-256 (prime256v1, secp256r1)
      • P-384 (secp384r1)
  • Browser Version

CLI

You can install ssh-fingerprint and use it from command line:

npm install -g ssh-fingerprint
ssh-fingerprint ~/.ssh/id_rsa.pub
2048 SHA256:yCB62vBVsOwqksgYwy/WDbaMF2PhPijAwcrlzmrxfko root@localhost (RSA)

(the output is the same as ssh-keygen -lf ~/.ssh/id_rsa.pub)

Usage

You can also use it from JavaScript:

SSH Fingerprint

var fs = require('fs');
var SSH = require('ssh-fingerprint');
var pub = fs.readFileSync("./id_rsa.pub");

SSH.fingerprint({ pub: pub }).then(function (fing) {
  console.info('The key fingerprint is:');
  console.info(fing.fingerprint, fing.comment);
  // SHA256:yCB62vBVsOwqksgYwy/WDbaMF2PhPijAwcrlzmrxfko root@localhost
});

Legal

ssh-fingerprint.js | MPL-2.0 | Terms of Use | Privacy Policy