You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Encrypt hex "00000000000000000000000000000000" with AES-128-ECB with key hex "00000000000000000000000000000000" results in "66e94bd4ef8a2c3b884cfa59ca342b2e0143db63ee66b0cdff9f69917680151e".
Expected output was "66e94bd4ef8a2c3b884cfa59ca342b2e". But the output was "66e94bd4ef8a2c3b884cfa59ca342b2e" + "0143db63ee66b0cdff9f69917680151e". It can be confirmed that "0143db63ee66b0cdff9f69917680151e" is the cipher text of a null string.
This doesn't appear to be a bug. Forge, the crypto library used by this operation, explicitly states that "CBC and ECB modes use PKCS#7 padding as default" which is typical for these operation modes. It can be seen that 0143db63ee66b0cdff9f69917680151e is the cipher text of a full padding block of 0x10 bytes: recipe
It might be useful though if these operations included the option to disable padding.
Summary
Encrypting a 16-byte text results in its own 16-byte cipher text with cipher text of null string appended.
Example
Recipe 1
Encrypt hex "00000000000000000000000000000000" with AES-128-ECB with key hex "00000000000000000000000000000000" results in "66e94bd4ef8a2c3b884cfa59ca342b2e0143db63ee66b0cdff9f69917680151e".
Expected output was "66e94bd4ef8a2c3b884cfa59ca342b2e". But the output was "66e94bd4ef8a2c3b884cfa59ca342b2e" + "0143db63ee66b0cdff9f69917680151e". It can be confirmed that "0143db63ee66b0cdff9f69917680151e" is the cipher text of a null string.
Recipe 2
The text was updated successfully, but these errors were encountered: