Class: Ccrypto::BCryptConfig
- Defined in:
- lib/ccrypto/configs/kdf_config.rb
Overview
BCrypt returns fixed 24 bytes (192 bits) output
Instance Attribute Summary collapse
-
#cost ⇒ Object
Cost is exponent 2^cost, range from 4 - 31 inclusive.
-
#cost_lowest_bound ⇒ Object
readonly
Returns the value of attribute cost_lowest_bound.
-
#cost_upper_bound ⇒ Object
readonly
Returns the value of attribute cost_upper_bound.
-
#max_input_byte_length ⇒ Object
readonly
Fixed output length of 24 bytes / 192 bits.
-
#outBitLength ⇒ Object
readonly
Fixed output length of 24 bytes / 192 bits.
-
#salt ⇒ Object
Salt is 16 bytes long.
-
#salt_length ⇒ Object
readonly
Returns the value of attribute salt_length.
Attributes inherited from KDFConfig
Class Method Summary collapse
- .cost_lowest_bound ⇒ Object
- .cost_upper_bound ⇒ Object
- .max_input_byte_length ⇒ Object
- .outBitLength ⇒ Object
- .outByteLength ⇒ Object
- .salt_length ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ BCryptConfig
constructor
A new instance of BCryptConfig.
Methods included from AlgoConfig
Constructor Details
#initialize ⇒ BCryptConfig
Returns a new instance of BCryptConfig.
159 160 161 162 163 164 165 166 167 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 159 def initialize #@salt = SecureRandom.random_bytes(16) @cost = 16 @outBitLength = self.class.outBitLength @max_input_byte_length = self.class.max_input_byte_length # 72 # bcrypt can only handle password <= 72 bytes (Java BC) @salt_length = self.class.salt_length @cost_lowest_bound = self.class.cost_lowest_bound @cost_upper_bound = self.class.cost_upper_bound end |
Instance Attribute Details
#cost ⇒ Object
Cost is exponent 2^cost, range from 4 - 31 inclusive
129 130 131 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 129 def cost @cost end |
#cost_lowest_bound ⇒ Object (readonly)
Returns the value of attribute cost_lowest_bound.
133 134 135 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 133 def cost_lowest_bound @cost_lowest_bound end |
#cost_upper_bound ⇒ Object (readonly)
Returns the value of attribute cost_upper_bound.
133 134 135 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 133 def cost_upper_bound @cost_upper_bound end |
#max_input_byte_length ⇒ Object (readonly)
Fixed output length of 24 bytes / 192 bits
132 133 134 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 132 def max_input_byte_length @max_input_byte_length end |
#outBitLength ⇒ Object (readonly)
Fixed output length of 24 bytes / 192 bits
132 133 134 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 132 def outBitLength @outBitLength end |
#salt ⇒ Object
Salt is 16 bytes long
127 128 129 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 127 def salt @salt end |
#salt_length ⇒ Object (readonly)
Returns the value of attribute salt_length.
133 134 135 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 133 def salt_length @salt_length end |
Class Method Details
.cost_lowest_bound ⇒ Object
151 152 153 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 151 def self.cost_lowest_bound 4 end |
.cost_upper_bound ⇒ Object
155 156 157 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 155 def self.cost_upper_bound 31 end |
.max_input_byte_length ⇒ Object
143 144 145 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 143 def self.max_input_byte_length 72 end |
.outBitLength ⇒ Object
135 136 137 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 135 def self.outBitLength 192 end |
.outByteLength ⇒ Object
139 140 141 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 139 def self.outByteLength 24 end |
.salt_length ⇒ Object
147 148 149 |
# File 'lib/ccrypto/configs/kdf_config.rb', line 147 def self.salt_length 16 end |