Module: SaltGenerator
- Defined in:
- lib/arkana/salt_generator.rb
Overview
Responsible for generating the salt.
Constant Summary collapse
- SALT_LENGTH =
64
Class Method Summary collapse
-
.generate ⇒ Salt
Generates and returns a new Salt object.
Class Method Details
.generate ⇒ Salt
Generates and returns a new Salt object.
13 14 15 16 17 |
# File 'lib/arkana/salt_generator.rb', line 13 def self.generate chars = SecureRandom.random_bytes(SALT_LENGTH).chars # Convert array of random bytes to array of characters codepoints = chars.map(&:ord) # Convert each character to its codepoint representation Salt.new(raw: codepoints) end |