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) ⇒ Object

Creates new Fingerprint from hex.

Args:

fingerprint_hex: hex string of the fingerprint.

Returns:

Imported Fingerprint.


54
55
56
57
# File 'lib/virgil/sdk/cryptography/hashes/fingerprint.rb', line 54

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

Instance Method Details

#to_hexObject

Fingerprint data in hexadecimal.

Returns:

Hexademical fingerprint representation.


71
72
73
74
# File 'lib/virgil/sdk/cryptography/hashes/fingerprint.rb', line 71

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

#valueObject

Raw fingerprint value.

Returns:
  Fingerprint bytes.


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

def value
  @fingerprint_bytes
end