Class: Virgil::SDK::Cryptography::Hashes::Fingerprint

Inherits:
Object
  • Object
show all
Defined in:
lib/virgil/sdk/cryptography/hashes/fingerprint.rb

Overview

Fingerprint container class.

Class provides methods for importing and exporting fingerprints.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fingerprint_bytes) ⇒ Fingerprint

Returns a new instance of Fingerprint



43
44
45
# File 'lib/virgil/sdk/cryptography/hashes/fingerprint.rb', line 43

def initialize(fingerprint_bytes)
  @fingerprint_bytes = fingerprint_bytes
end

Class Method Details

.from_hex(fingerprint_hex) ⇒ FingerPrint

Creates new Fingerprint from hex.

Parameters:

  • fingerprint_hex (String)

    hex string of the fingerprint.

Returns:

  • (FingerPrint)

    Imported Fingerprint.



50
51
52
53
# File 'lib/virgil/sdk/cryptography/hashes/fingerprint.rb', line 50

def self.from_hex(fingerprint_hex)
  data = Crypto::Native::VirgilByteArrayUtils.hex_to_bytes(fingerprint_hex)
  return self.new(data)
end

Instance Method Details

#to_hexString

Fingerprint data in hexadecimal.

Returns:

  • (String)

    Hexademical fingerprint representation.



63
64
65
66
# File 'lib/virgil/sdk/cryptography/hashes/fingerprint.rb', line 63

def to_hex
  hex_data = Crypto::Native::VirgilByteArrayUtils.bytes_to_hex(value)
  return hex_data
end

#valueCrypto::Bytes

Raw fingerprint value.

Returns:

  • (Crypto::Bytes)

    Fingerprint bytes.



57
58
59
# File 'lib/virgil/sdk/cryptography/hashes/fingerprint.rb', line 57

def value
  @fingerprint_bytes
end