Example using AES
This example uses AES-128 to encrypt a short message "Hello" using the 128-bit key 0xA456B7A422C5145ABCF2B3CB206579A8. The block size of 128 bits is equal to 128/8 = 16 bytes, so we need to pad our 5-byte plaintext with an 11-byte padding string. The ASCII characters "Hello" are 48656C6C6F in hexadecimal and 11 decimal = 0x0B.
Method 1 PKCS#7/RFC3369 method
AES INPUT BLOCK = 48656C6C6F0B0B0B0B0B0B0B0B0B0B0B
AES OUTPUT BLOCK = 42FF63CC06D53DA93F24389723E1611A
Method 2 Pad with 0x80 + nulls
AES INPUT BLOCK = 48656C6C6F8000000000000000000000
AES OUTPUT BLOCK = 97AFA1455DA9E2E1B821275997CF4DC5
Method 3 Pad with nulls + # bytes
AES INPUT BLOCK = 48656C6C6F000000000000000000000B
AES OUTPUT BLOCK = 6024D07C11283639425E3A33D99F32BA
Method 4 Pad with nulls
AES INPUT BLOCK = 48656C6C6F0000000000000000000000
AES OUTPUT BLOCK = 3FC6C30A64CD6E2970803871C7068998
Method 5 Pad with spaces
AES INPUT BLOCK = 48656C6C6F2020202020202020202020
AES OUTPUT BLOCK = 7FB72E7BE929223D001E3129DFFA20A0
This example uses AES-128 to encrypt a short message "Hello" using the 128-bit key 0xA456B7A422C5145ABCF2B3CB206579A8. The block size of 128 bits is equal to 128/8 = 16 bytes, so we need to pad our 5-byte plaintext with an 11-byte padding string. The ASCII characters "Hello" are 48656C6C6F in hexadecimal and 11 decimal = 0x0B.
Method 1 PKCS#7/RFC3369 method
AES INPUT BLOCK = 48656C6C6F0B0B0B0B0B0B0B0B0B0B0B
AES OUTPUT BLOCK = 42FF63CC06D53DA93F24389723E1611A
Method 2 Pad with 0x80 + nulls
AES INPUT BLOCK = 48656C6C6F8000000000000000000000
AES OUTPUT BLOCK = 97AFA1455DA9E2E1B821275997CF4DC5
Method 3 Pad with nulls + # bytes
AES INPUT BLOCK = 48656C6C6F000000000000000000000B
AES OUTPUT BLOCK = 6024D07C11283639425E3A33D99F32BA
Method 4 Pad with nulls
AES INPUT BLOCK = 48656C6C6F0000000000000000000000
AES OUTPUT BLOCK = 3FC6C30A64CD6E2970803871C7068998
Method 5 Pad with spaces
AES INPUT BLOCK = 48656C6C6F2020202020202020202020
AES OUTPUT BLOCK = 7FB72E7BE929223D001E3129DFFA20A0