cryptonite-0.30: Cryptography Primitives sink

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | unknown
Safe Haskell | Safe-Inferred
Language | Haskell2010

Crypto.Data.Padding

Description

Various cryptographic padding commonly used for block ciphers or asymmetric systems.

Synopsis

- data Format
  - = PKCS5
  - | PKCS7 Int
  - | ZERO Int
- pad :: ByteArray byteArray => Format -> byteArray -> byteArray
- unpad :: ByteArray byteArray => Format -> byteArray -> Maybe byteArray

# Documentation

data Format Source #

Format of padding

Constructors

PKCS5 | PKCS5: PKCS7 with hardcoded size of 8
PKCS7 Int | PKCS7 with padding size between 1 and 255
ZERO Int | zero padding with block size

#### Instances

Instances details

Show Format Source # |
Instance details Defined in Crypto.Data.Padding Methods showsPrec :: Int -> Format -> ShowS Source # show :: Format -> String Source # showList :: [Format] -> ShowS Source #
Eq Format Source # |
Instance details Defined in Crypto.Data.Padding Methods (==) :: Format -> Format -> Bool Source # (/=) :: Format -> Format -> Bool Source #

pad :: ByteArray byteArray => Format -> byteArray -> byteArray Source #

Apply some pad to a bytearray

unpad :: ByteArray byteArray => Format -> byteArray -> Maybe byteArray Source #

Try to remove some padding from a bytearray.