Sha256: 62b4640fe1ca1492a6d6b9ad9a93de870807df524d547b005af58a1f34ec4375
Contents?: true
Size: 579 Bytes
Versions: 22
Compression:
Stored size: 579 Bytes
Contents
require 'openssl' module S3backup class Crypt CIPHER_ALGORITHM="aes-256-cbc" def initialize(password,salt) @password = password @salt = salt.scan(/../).map{|i|i.hex}.pack("c*") end def encrypt(data) enc = OpenSSL::Cipher::Cipher.new(CIPHER_ALGORITHM) enc.encrypt enc.pkcs5_keyivgen(@password,@salt) enc.update(data)+enc.final end def decrypt(data) enc = OpenSSL::Cipher::Cipher.new(CIPHER_ALGORITHM) enc.decrypt enc.pkcs5_keyivgen(@password,@salt) enc.update(data)+enc.final end end end
Version data entries
22 entries across 22 versions & 1 rubygems