-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aes encryption result is incorrect #29
Comments
Your key length is not 32 bytes. |
len(12345678901234567890123456789012) = 32 |
This is not a key. The key should be a slice of 32 bytes, not a string of 32 characters. |
The correctness is already tested with these testcases: crypto2/src/blockcipher/aes/mod.rs Lines 38 to 96 in f32eccf
AES is a symmetric cipher algorithm, which means that the cipher text's length should be identical with the text. Your Java output:
should have included some kind of padding, because it is exactly 16bytes length (128-bits), which is AES's block length. A little bit of searching shows that:
|
java code
java code ouput
rust code
rust code ouput
base64("12345678901234567890123456789012") = "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI"
aes online result
Is there anything wrong with how I use it?
The text was updated successfully, but these errors were encountered: