Documentation ¶
Overview ¶
Package pad implements some padding schemes for block ciphers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Padding ¶
type Padding interface { // BlockSize returns the block size of the padding. BlockSize() int // Returns the overhead, the padding will cause // by padding the given byte slice. The overhead // will always be between 1 and BlockSize() inclusively. Overhead(src []byte) int // Pads the last (may incomplete) block of the src slice // to a padded and complete block, appends the padding bytes // to the src slice and returns this slice. // The length of the returned slice is len(src) + Overhead(src) Pad(src []byte) []byte // Takes a slice and tries to remove the padding bytes // form the last block. Therefore the length of the // src argument must be a multiply of the blocksize. // If the returned error is nil, the padding could be // removed successfully. The returned slice holds the // unpadded src bytes. Unpad(src []byte) ([]byte, error) }
The Padding interface represents a padding scheme.
func NewISO10126 ¶
NewISO10126 returns a new pad.Padding, which uses the padding scheme described in ISO 10126. The padding bytes are taken form the given rand argument. If rand is nil, crypto/rand will be used. Only block sizes between 1 and 255 are valid.
Click to show internal directories.
Click to hide internal directories.