Module: Lightning::Onion::ChaCha20

Defined in:
lib/lightning/onion/chacha20.rb,
lib/lightning/onion/chacha20/pure.rb,
lib/lightning/onion/chacha20/openssl.rb

Defined Under Namespace

Classes: OpenSSL, Pure

Class Method Summary collapse

Class Method Details

.chacha20_encrypt(key, counter, nonce, plaintext) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/lightning/onion/chacha20.rb', line 9

def self.chacha20_encrypt(key, counter, nonce, plaintext)
  if ::OpenSSL::Cipher.ciphers.include?("ChaCha20")
    Lightning::Onion::ChaCha20::OpenSSL.chacha20_encrypt(key, counter, nonce, plaintext)
  else
    Lightning::Onion::ChaCha20::Pure.chacha20_encrypt(key, counter, nonce, plaintext)
  end
end