Class: RubyHome::HAP::Crypto::ChaCha20Poly1305
- Inherits:
-
Object
- Object
- RubyHome::HAP::Crypto::ChaCha20Poly1305
- Defined in:
- lib/ruby_home/hap/crypto/chacha20poly1305.rb
Instance Method Summary collapse
- #decrypt(nonce, ciphertext, additional_data = nil) ⇒ Object
- #encrypt(nonce, message, additional_data = nil) ⇒ Object
-
#initialize(key) ⇒ ChaCha20Poly1305
constructor
A new instance of ChaCha20Poly1305.
Constructor Details
#initialize(key) ⇒ ChaCha20Poly1305
Returns a new instance of ChaCha20Poly1305.
5 6 7 |
# File 'lib/ruby_home/hap/crypto/chacha20poly1305.rb', line 5 def initialize(key) @key = key end |
Instance Method Details
#decrypt(nonce, ciphertext, additional_data = nil) ⇒ Object
13 14 15 |
# File 'lib/ruby_home/hap/crypto/chacha20poly1305.rb', line 13 def decrypt(nonce, ciphertext, additional_data=nil) chacha20poly1305ietf.decrypt(nonce, ciphertext, additional_data) end |
#encrypt(nonce, message, additional_data = nil) ⇒ Object
9 10 11 |
# File 'lib/ruby_home/hap/crypto/chacha20poly1305.rb', line 9 def encrypt(nonce, , additional_data=nil) chacha20poly1305ietf.encrypt(nonce, , additional_data) end |