module Aescryptor
Constants
- VERSION
Public Class Methods
decrypt(encrypted_data, key, iv=nil, cipher_type="AES-256-CBC")
click to toggle source
# File lib/aescryptor.rb, line 8 def decrypt(encrypted_data, key, iv=nil, cipher_type="AES-256-CBC") aes = OpenSSL::Cipher::Cipher.new(cipher_type) aes.decrypt aes.key = key aes.iv = iv if iv != nil aes.update([encrypted_data].pack("H*")) + aes.final end
encrypt(data, key, iv=nil, cipher_type="AES-256-CBC")
click to toggle source
# File lib/aescryptor.rb, line 16 def encrypt(data, key, iv=nil, cipher_type="AES-256-CBC") aes = OpenSSL::Cipher::Cipher.new(cipher_type) aes.encrypt aes.key = key aes.iv = iv if iv != nil (aes.update(data) + aes.final).unpack("H*")[0] end