padding

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package padding provides functions to handle padding in block ciphers.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWrongPadding = errors.New("wrong padding")
	ErrBadBlockSize = errors.New("bad block size")
	ErrDataSize     = errors.New("input is not a multiple of block size")
)

Errors

Functions

This section is empty.

Types

type Padding

type Padding interface {
	// Pad appends padding to b to align it to a block size.
	// The block size must be greater than 1.
	Pad(b []byte, blockSize int) []byte

	// Strip removes the padding from b.  The resulting slice will always
	// be a subslice of the argument.  The block size must be greater than 1.
	Strip(b []byte, blockSize int) ([]byte, error)
}

Padding is a padding algorithm.

var PKCS7 Padding = pkcs7{}

PKCS7 implements the padding algorithm as described in PKCS #7 section 10.3. The block size must be less than 256.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL