test/test_aes.rb in aes-0.4.0 vs test/test_aes.rb in aes-0.5.0

- old
+ new

@@ -17,9 +17,20 @@ iv = AES.iv(:base_64) enc1 = AES.encrypt(msg, key, {:iv => iv}) enc2 = AES.encrypt(msg, key, {:iv => iv}) assert_equal enc1, enc2 end + + should "handle padding option" do + key = "01234567890123456789012345678901" + msg = "This is a message that nobody should ever see" + # unpadded message length should be a multiple of cipher block + # length (16 bytes) + msg += " "*(16 - (msg.length % 16)) + + enc = AES.encrypt(msg, key, {:padding => false}) + assert_equal msg, AES.decrypt(enc, key, {:padding => false}) + end should "generate a new key when AES#key" do assert_equal 32, AES.key.length assert_equal 44, AES.key(256, :base_64).length end