Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
module Keen
class AESHelperOld
def self.aes256_encrypt(key, plaintext, iv = nil)
puts 'IN DA MONKEY PATCH!'
padded_key = key
aes = OpenSSL::Cipher::AES.new(256, :CBC)
aes.encrypt
aes.key = padded_key
aes.iv = iv unless iv.nil?
iv ||= aes.random_iv
encrypted = aes.update(plaintext) + aes.final
hexlify(iv) + hexlify(encrypted)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.