Class: Claude::RandomIV
- Inherits:
-
Object
- Object
- Claude::RandomIV
- Defined in:
- lib/claude/random_iv.rb
Class Method Summary collapse
-
.generate ⇒ Object
A shortcut for RandomIV.new(Claude.coder).generate.
Instance Method Summary collapse
-
#generate ⇒ Object
Generates a secure random Initialization Vector that can be used for OpenSSL encryption and decryption.
-
#initialize(coder = Claude.coder) ⇒ RandomIV
constructor
A new instance of RandomIV.
Constructor Details
#initialize(coder = Claude.coder) ⇒ RandomIV
11 12 13 |
# File 'lib/claude/random_iv.rb', line 11 def initialize(coder = Claude.coder) @coder = coder end |
Class Method Details
.generate ⇒ Object
A shortcut for RandomIV.new(Claude.coder).generate.
7 8 9 |
# File 'lib/claude/random_iv.rb', line 7 def self.generate new.generate end |
Instance Method Details
#generate ⇒ Object
Generates a secure random Initialization Vector that can be used for OpenSSL encryption and decryption.
It is encoded by a coder, so the IV consists of DB friendly characters.
19 20 21 |
# File 'lib/claude/random_iv.rb', line 19 def generate coder.encode(cipher.random_iv) end |