Class: Bitcoin::BIP324::FSChaCha20
- Inherits:
-
Object
- Object
- Bitcoin::BIP324::FSChaCha20
- Defined in:
- lib/bitcoin/bip324/fs_chacha20.rb
Overview
Rekeying wrapper stream cipher around ChaCha20.
Instance Attribute Summary collapse
-
#block_counter ⇒ Object
Returns the value of attribute block_counter.
-
#chunk_counter ⇒ Object
Returns the value of attribute chunk_counter.
-
#key ⇒ Object
Returns the value of attribute key.
-
#key_stream ⇒ Object
Returns the value of attribute key_stream.
-
#rekey_interval ⇒ Object
readonly
Returns the value of attribute rekey_interval.
Instance Method Summary collapse
-
#decrypt(chunk) ⇒ String
Decrypt a chunk.
-
#encrypt(chunk) ⇒ String
Encrypt a chunk.
-
#initialize(initial_key, rekey_interval = BIP324::REKEY_INTERVAL) ⇒ FSChaCha20
constructor
A new instance of FSChaCha20.
Constructor Details
#initialize(initial_key, rekey_interval = BIP324::REKEY_INTERVAL) ⇒ FSChaCha20
Returns a new instance of FSChaCha20.
78 79 80 81 82 83 84 |
# File 'lib/bitcoin/bip324/fs_chacha20.rb', line 78 def initialize(initial_key, rekey_interval = BIP324::REKEY_INTERVAL) @block_counter = 0 @chunk_counter = 0 @key = initial_key @rekey_interval = rekey_interval @key_stream = '' end |
Instance Attribute Details
#block_counter ⇒ Object
Returns the value of attribute block_counter.
75 76 77 |
# File 'lib/bitcoin/bip324/fs_chacha20.rb', line 75 def block_counter @block_counter end |
#chunk_counter ⇒ Object
Returns the value of attribute chunk_counter.
74 75 76 |
# File 'lib/bitcoin/bip324/fs_chacha20.rb', line 74 def chunk_counter @chunk_counter end |
#key ⇒ Object
Returns the value of attribute key.
72 73 74 |
# File 'lib/bitcoin/bip324/fs_chacha20.rb', line 72 def key @key end |
#key_stream ⇒ Object
Returns the value of attribute key_stream.
76 77 78 |
# File 'lib/bitcoin/bip324/fs_chacha20.rb', line 76 def key_stream @key_stream end |
#rekey_interval ⇒ Object (readonly)
Returns the value of attribute rekey_interval.
73 74 75 |
# File 'lib/bitcoin/bip324/fs_chacha20.rb', line 73 def rekey_interval @rekey_interval end |