Sha256: 65d442c4c364bad4d4050df250ff1a4487894f47fa6264c87bac9ea3162d8748

Contents?: true

Size: 554 Bytes

Versions: 9

Compression:

Stored size: 554 Bytes

Contents

module Rmega
  module Crypto
    module AesCtr
      def aes_ctr_cipher
        OpenSSL::Cipher::AES.new(128, :CTR)
      end

      def aes_ctr_decrypt(key, data, iv)
        cipher = aes_ctr_cipher
        cipher.decrypt
        cipher.iv = iv
        cipher.key = key
        return cipher.update(data) + cipher.final
      end

      def aes_ctr_encrypt(key, data, iv)
        cipher = aes_ctr_cipher
        cipher.encrypt
        cipher.iv = iv
        cipher.key = key
        return cipher.update(data) + cipher.final
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rmega-0.3.2 lib/rmega/crypto/aes_ctr.rb
rmega-0.3.1 lib/rmega/crypto/aes_ctr.rb
rmega-0.2.7 lib/rmega/crypto/aes_ctr.rb
rmega-0.2.6 lib/rmega/crypto/aes_ctr.rb
rmega-0.2.5 lib/rmega/crypto/aes_ctr.rb
rmega-0.2.4 lib/rmega/crypto/aes_ctr.rb
rmega-0.2.2 lib/rmega/crypto/aes_ctr.rb
rmega-0.2.1 lib/rmega/crypto/aes_ctr.rb
rmega-0.2.0 lib/rmega/crypto/aes_ctr.rb