class Stribog::Digest
Class, returning by CreateHash#call
Contains binary and hex representation of digest. You can use {#binary} to get array and {#hex} to get digest in hash. @author WildDima
Attributes
dec[R]
vector[R]
Contains binary representation of hash
@api public @example
digest.binary
@return [Array] binary representation of digest
Public Class Methods
new(vector:)
click to toggle source
Contains hex value of hash
@api public @example
digest.hex
@return [String] hex representation of digest
# File lib/stribog/digest.rb, line 26 def initialize(vector:) @vector = vector @dec = vector.to_dec end
Public Instance Methods
base64()
click to toggle source
# File lib/stribog/digest.rb, line 36 def base64 Base64.encode64(dec.to_s) end
hex()
click to toggle source
# File lib/stribog/digest.rb, line 31 def hex dec.to_s(16) end
Also aliased as: to_hex
pack(meaning = 'C*')
click to toggle source
# File lib/stribog/digest.rb, line 40 def pack(meaning = 'C*') binary.to_byte_array.pack(meaning) end