Class: RubyHome::HAP::Crypto::ChaCha20Poly1305

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_home/hap/crypto/chacha20poly1305.rb

Instance Method Summary collapse

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, message, additional_data=nil)
  chacha20poly1305ietf.encrypt(nonce, message, additional_data)
end