| License | BSD-style |
|---|---|
| Maintainer | Vincent Hanquez <vincent@snarc.org> |
| Stability | experimental |
| Portability | unknown |
| Safe Haskell | None |
| Language | Haskell2010 |
Crypto.Data.Padding
Description
Various cryptographic padding commonly used for block ciphers or asymmetric systems.
Documentation
Format of padding
unpad :: ByteArray byteArray => Format -> byteArray -> Maybe byteArray Source #
Try to remove some padding from a bytearray.
PKCS7 padding says how long it is, so this undoes pad exactly.
ZERO padding says nothing, and pad adds none at all when the input is
already a multiple of the block size, so there is no way to tell padding
from data that happens to end in zero octets. This therefore does not undo
pad: it returns the input unchanged when the last octet is not zero, and
Nothing when it is, rather than guess and hand back less than it was
given. Zero padding is only usable where the original length is known by
other means.