Class: Salt
- Inherits:
-
Object
- Object
- Salt
- Defined in:
- lib/arkana/models/salt.rb
Overview
Model used to hold the metadata for the salt bytes.
Instance Attribute Summary collapse
-
#formatted ⇒ Object
readonly
Salt, formatted as a string of comma-separated hexadecimal numbers, e.g.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
-
#initialize(raw:) ⇒ Salt
constructor
A new instance of Salt.
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
#formatted ⇒ Object (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 |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
7 8 9 |
# File 'lib/arkana/models/salt.rb', line 7 def raw @raw end |