A question of PKCS5
A question of PKCS5
Hi, everyone.
Anyone know how to calculate PKCS5 padding algorithm?
I knew that the PKCS5 padding algorithm fills bytes at the end of data until the length of total data is multiple block size.
For example, AES block size is 32 bytes. And the data is 30 bytes. The padding bytes is "0202". If the data is 28 bytes, the padding bytes will be "04040404". But If the data length is 32 bytes too, whether I should add 32bytes padding bytes?
Anyone know how to calculate PKCS5 padding algorithm?
I knew that the PKCS5 padding algorithm fills bytes at the end of data until the length of total data is multiple block size.
For example, AES block size is 32 bytes. And the data is 30 bytes. The padding bytes is "0202". If the data is 28 bytes, the padding bytes will be "04040404". But If the data length is 32 bytes too, whether I should add 32bytes padding bytes?
Re: A question of PKCS5
(1) AES block size is not 32 bytes, it is 16 bytes;
(2) if the data is 16 bytes, you still need to pad 0x10 to the end until its length is 32bytes;
(3) you need to pad at any case, even if the length is times of block size.
(2) if the data is 16 bytes, you still need to pad 0x10 to the end until its length is 32bytes;
(3) you need to pad at any case, even if the length is times of block size.
Re: A question of PKCS5
yeah, I will try it.
Who is online
Users browsing this forum: No registered users and 44 guests