Sha256: d15b2ef4ae834f1161bf85d18478a70847783459ae5a845eb0d8ee52912f3453

Contents?: true

Size: 560 Bytes

Versions: 1

Compression:

Stored size: 560 Bytes

Contents

# frozen_string_literal: true

module Lightning
  module Onion
    module ChaCha20
      autoload :OpenSSL, 'lightning/onion/chacha20/openssl'
      autoload :Pure, 'lightning/onion/chacha20/pure'

      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lightning-onion-0.2.10 lib/lightning/onion/chacha20.rb