module Lightning::Onion::ChaCha20

Public Class Methods

chacha20_encrypt(key, counter, nonce, plaintext) click to toggle source
# 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