Class: Ccrypto::Argon2Config
- Defined in:
- lib/ccrypto/configs/kdf_config.rb
Overview
PBKDF2Config
Instance Attribute Summary collapse
-
#cost ⇒ Object
Returns the value of attribute cost.
-
#iter ⇒ Object
Returns the value of attribute iter.
-
#outBitLength ⇒ Object
Returns the value of attribute outBitLength.
-
#parallel ⇒ Object
Returns the value of attribute parallel.
-
#salt ⇒ Object
Returns the value of attribute salt.
-
#secret ⇒ Object
Returns the value of attribute secret.
-
#variant ⇒ Object
Returns the value of attribute variant.
Attributes inherited from KDFConfig
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Argon2Config
constructor
A new instance of Argon2Config.
Methods included from AlgoConfig
Constructor Details
#initialize ⇒ Argon2Config
Returns a new instance of Argon2Config.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 85 def initialize @algo = :argon2 # "salt" which can be stored non-secure or with the password Hash @salt = SecureRandom.random_bytes(16) # Secret value which has to be stored in a different secure location from the password hashes #@secret = SecureRandom.random_bytes(16) # The RFC recommends 4 GB for backend authentication and 1 GB for frontend authentication. # Unit is in Kilobytes. Min is 8 kb. Convert internally to kb hence the value is 8192 # 1024*1024 = 1048576 (1GB) #@cost = 1048576 # 25 Dec 2023 - Change it to 2**@cont value below # 1GB = 2**20 hence the @cont value should be 20 if 1GB RAM is required @cont = 20 # Choose the Number of CPU-Threads you can afford each call (2 Cores = 4 Threads) @parallel = 1 # Set the number of Iterations each call -> More Iterations = Better Security + more Hashing Time # > 3 Iterations recommended @iter = 3 # Follow BC library # Argon2d # Argon2i (recommended) # Argon2id # Argon2_version_10 # Argon2_version_13 @variant = :argon2i end |
Instance Attribute Details
#cost ⇒ Object
Returns the value of attribute cost.
77 78 79 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 77 def cost @cost end |
#iter ⇒ Object
Returns the value of attribute iter.
77 78 79 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 77 def iter @iter end |
#outBitLength ⇒ Object
Returns the value of attribute outBitLength.
79 80 81 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 79 def outBitLength @outBitLength end |
#parallel ⇒ Object
Returns the value of attribute parallel.
77 78 79 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 77 def parallel @parallel end |
#salt ⇒ Object
Returns the value of attribute salt.
77 78 79 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 77 def salt @salt end |
#secret ⇒ Object
Returns the value of attribute secret.
77 78 79 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 77 def secret @secret end |
#variant ⇒ Object
Returns the value of attribute variant.
78 79 80 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 78 def variant @variant end |
Class Method Details
.variants ⇒ Object
81 82 83 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 81 def self.variants [:argon2d, :argon2i, :argon2id, :argon2_version_10, :argon2_version_13].freeze end |