EDIT: If the message length is equal to the pad length, you have to pad to the next multiple. E.g. 16 bytes would be padded to 32 because one would not know how long the message was because the last byte defines the number of added (=padded) values.
Here's another example to pad/depad data for...
For some solutions you need to pad data to a specific length (=blocksize or a multiple of x, like a multiple of 16 in AES). This snippet gets the next higher multiple of the padding. If your data is 5 bytes long, the blocksize would be 16, having 17 bytes it would be 32.
Dim PadTo As Int = 16...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.