lib/gibberish/aes.rb in gibberish-1.2.1 vs lib/gibberish/aes.rb in gibberish-1.2.2
- old
+ new
@@ -29,13 +29,15 @@
# Initialize with the password
#
# @param [String] password
# @param [Integer] size
- def initialize(password, size=256)
+ # @param [String] mode
+ def initialize(password, size=256, mode="cbc")
@password = password
@size = size
- @cipher = OpenSSL::Cipher::Cipher.new("aes-#{size}-cbc")
+ @mode = mode
+ @cipher = OpenSSL::Cipher::Cipher.new("aes-#{size}-#{mode}")
end
def encrypt(data, opts={})
salt = generate_salt(opts[:salt])
setup_cipher(:encrypt, salt)