Sha256: b982047fd51cc2bb73f25fe521968ddfc975b39acd543360bcf319d13488b1ac

Contents?: true

Size: 511 Bytes

Versions: 2

Compression:

Stored size: 511 Bytes

Contents

require 'openssl'

module SSHScan
  module Crypto
    class PublicKey
      def initialize(key)
        @key = key
      end

      def fingerprint_md5
        OpenSSL::Digest::MD5.hexdigest(Base64.decode64(@key)).scan(/../).join(':')
      end

      def fingerprint_sha1
        OpenSSL::Digest::SHA1.hexdigest(Base64.decode64(@key)).scan(/../).join(':')
      end

      def fingerprint_sha256
        OpenSSL::Digest::SHA256.hexdigest(Base64.decode64(@key)).scan(/../).join(':')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ssh_scan-0.0.17 lib/ssh_scan/crypto.rb
ssh_scan-0.0.17.pre lib/ssh_scan/crypto.rb