violuke / rsa-ssh-key-fingerprint
Generate a fingerprint from an RSA SSH public key.
Installs: 72 423
Dependents: 1
Suggesters: 0
Security: 0
Stars: 9
Watchers: 1
Forks: 3
Open Issues: 0
Requires
- php: >=7.3
Requires (Dev)
- phpunit/phpunit: ^9
This package is auto-updated.
Last update: 2024-11-13 15:36:56 UTC
README
PHP class for generating fingerprints from RSA SSH public keys
https://packagist.org/packages/violuke/rsa-ssh-key-fingerprint
Installation
$ composer require violuke/rsa-ssh-key-fingerprint
Usage (default MD5 fingerprint)
$key = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHbry1PSM+P0eQZX32b8Gy/cAkxktpzB0hVPnvLDAqUGA2k7e4MJz7V4jYpNqeWUMqElKSAgn/GYwra7U2YpA/eZWSPpWIL2pwy4oQ2+bRaSzlt6wyB4aTLG1dHRFl+kYK3dN3XDdjY2Fx+xQX809eeWtmqBWy5khbQ2Fx0ovK6f0mSbtJRMrLioBYQ/2YQXeR5HQH8CjLZHJ8XeY4BjJ0D+W0yRim+uD7d3CqCUlR2BVDi0MevVMnvwefKQD9cJMOJSsHdGP8Vm/PMpZ5tS4JSTULVkBHfzpC/2D7AI4jbAxUO9j7kChaRY+te+6mYLJGkUtgMDOrTNTaOEAKjeO/ lukecousins@Lukes-iMac.local'; $fingerprint = violuke\RsaSshKeyFingerprint\FingerprintGenerator::getFingerprint($key); echo $fingerprint;
Outputs:
74:e7:80:bf:89:11:31:55:f7:4d:78:86:0d:fd:13:f5
Usage (SHA256 fingerprint)
$key = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHbry1PSM+P0eQZX32b8Gy/cAkxktpzB0hVPnvLDAqUGA2k7e4MJz7V4jYpNqeWUMqElKSAgn/GYwra7U2YpA/eZWSPpWIL2pwy4oQ2+bRaSzlt6wyB4aTLG1dHRFl+kYK3dN3XDdjY2Fx+xQX809eeWtmqBWy5khbQ2Fx0ovK6f0mSbtJRMrLioBYQ/2YQXeR5HQH8CjLZHJ8XeY4BjJ0D+W0yRim+uD7d3CqCUlR2BVDi0MevVMnvwefKQD9cJMOJSsHdGP8Vm/PMpZ5tS4JSTULVkBHfzpC/2D7AI4jbAxUO9j7kChaRY+te+6mYLJGkUtgMDOrTNTaOEAKjeO/ lukecousins@Lukes-iMac.local'; $fingerprint = violuke\RsaSshKeyFingerprint\FingerprintGenerator::getFingerprint($key, 'sha256'); echo $fingerprint;
Outputs:
6EbRDmqVEmgAD6FOXQuIiG8uUSteIDKZzj2bgZ+88V0=
Testing
$ ./vendor/bin/phpunit tests