Sha256: d1097e87434f8c6cc3b5841eb24c18c398208d83452ef4e6bd86787e7286cc9d

Contents?: true

Size: 554 Bytes

Versions: 9

Compression:

Stored size: 554 Bytes

Contents

module Rmega
  module Crypto
    module AesEcb
      def aes_ecb_cipher
        OpenSSL::Cipher::AES.new(128, :ECB)
      end

      def aes_ecb_encrypt(key, data)
        cipher = aes_ecb_cipher
        cipher.encrypt
        cipher.padding = 0
        cipher.key = key
        return cipher.update(data) + cipher.final
      end

      def aes_ecb_decrypt(key, data)
        cipher = aes_ecb_cipher
        cipher.decrypt
        cipher.padding = 0
        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_ecb.rb
rmega-0.3.1 lib/rmega/crypto/aes_ecb.rb
rmega-0.2.7 lib/rmega/crypto/aes_ecb.rb
rmega-0.2.6 lib/rmega/crypto/aes_ecb.rb
rmega-0.2.5 lib/rmega/crypto/aes_ecb.rb
rmega-0.2.4 lib/rmega/crypto/aes_ecb.rb
rmega-0.2.2 lib/rmega/crypto/aes_ecb.rb
rmega-0.2.1 lib/rmega/crypto/aes_ecb.rb
rmega-0.2.0 lib/rmega/crypto/aes_ecb.rb