lib/gibberish/aes.rb in gibberish-1.3.0 vs lib/gibberish/aes.rb in gibberish-1.3.1
- old
+ new
@@ -53,9 +53,10 @@
end
alias :enc :encrypt
alias :e :encrypt
def decrypt(data, opts={})
+ raise ArgumentError, 'Data is too short' unless data.length >= 16
data = Base64.decode64(data) unless opts[:binary]
salt = data[8..15]
data = data[16..-1]
setup_cipher(:decrypt, salt)
cipher.update(data) + cipher.final