Class: Salt

Inherits:
Object
  • Object
show all
Defined in:
lib/arkana/models/salt.rb

Overview

Model used to hold the metadata for the salt bytes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw:) ⇒ Salt

Returns a new instance of Salt.



11
12
13
14
15
16
17
18
19
# File 'lib/arkana/models/salt.rb', line 11

def initialize(raw:)
  @raw = raw
  formatted_salt = []
  raw.each do |element|
    # Warning: this might be specific to Swift implementation. When generating code for other languages, beware.
    formatted_salt << format("%#x", element)
  end
  @formatted = formatted_salt.join(", ")
end

Instance Attribute Details

#formattedObject (readonly)

Salt, formatted as a string of comma-separated hexadecimal numbers, e.g. “0x94, 0x11, 0x1b, 0x6, 0x49, 0, 0xa7”



9
10
11
# File 'lib/arkana/models/salt.rb', line 9

def formatted
  @formatted
end

#rawObject (readonly)

Returns the value of attribute raw.



7
8
9
# File 'lib/arkana/models/salt.rb', line 7

def raw
  @raw
end