padding

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package padding implements common block cipher padding schemes.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Bit is the bit padding scheme.
	Bit bit

	// ISO10126 is the ISO/IEC 10126 padding scheme.
	ISO10126 iso10126

	// ISO7816 is the ISO/IEC 7816-4 padding scheme.
	ISO7816 iso7816

	// PKCS5 is the PKCS #5 padding scheme.
	PKCS5 pkcs5

	// PKCS7 is the PKCS #7 padding scheme.
	PKCS7 pkcs7

	// TBC is the trailing bit complement padding scheme.
	TBC tbc

	// X923 is the ANSI X9.23 padding scheme.
	X923 x923

	// Zero is the zero padding scheme.
	Zero zero
)

Functions

func OverheadSize

func OverheadSize(length, blocksize int) int

OverheadSize returns the padding length for length and blocksize.

Types

type BlockSizeError

type BlockSizeError int

BlockSizeError is returned when a padding block size is invalid.

func (BlockSizeError) Error

func (i BlockSizeError) Error() string

type InvalidDataError

type InvalidDataError int

InvalidDataError is returned when padded data is malformed.

func (InvalidDataError) Error

func (i InvalidDataError) Error() string

type Padding

type Padding interface {
	Pad(b []byte, blocksize int) ([]byte, error)
	String() string
	Unpad(b []byte, blocksize int) ([]byte, error)
}

Padding pads and unpads block cipher input.

Jump to

Keyboard shortcuts

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