Documentation ¶
Index ¶
- func DePadding(data []byte, method PaddingType, blockSize int) ([]byte, error)
- func DePaddingISO97971(data []byte) []byte
- func DePaddingPKCS5(data []byte) []byte
- func DePaddingPKCS7(data []byte) []byte
- func DePaddingZero(data []byte) []byte
- func Padding(data []byte, method PaddingType, blockSize int) ([]byte, error)
- func PaddingISO97971(data []byte, blockSize int) []byte
- func PaddingPKCS5(data []byte) []byte
- func PaddingPKCS7(data []byte, blockSize int) []byte
- func PaddingZero(data []byte, blockSize int) []byte
- type PaddingType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DePadding ¶
func DePadding(data []byte, method PaddingType, blockSize int) ([]byte, error)
DePadding depads data with method provided such as Zero Padding.
func DePaddingISO97971 ¶
DePaddingISO97971 is similar with PKCS7, its block size is 8.
func DePaddingPKCS5 ¶
DePaddingPKCS5 is similar with PKCS7, its block size is 8.
func DePaddingPKCS7 ¶
DePaddingPKCS7 remove PKCS7 padding at the end of byte slice.
func DePaddingZero ¶
DePaddingZero remove zero padding at the end of byte slice.
func Padding ¶
func Padding(data []byte, method PaddingType, blockSize int) ([]byte, error)
Padding pads data with method provided such as Zero Padding.
func PaddingISO97971 ¶
PaddingISO97971 add padding at the end of byte slice with zero bytes which are separated by 0x80.
func PaddingPKCS5 ¶
PaddingPKCS5 is similar with PKCS7, its block size is 8.
func PaddingPKCS7 ¶
PaddingPKCS7 add padding at the end of byte slice with PKCS7 bytes. PKCS7 padding is a generalization of PKCS5 padding (also known as standard padding). PKCS7 padding works by appending N bytes with the value of chr(N) , where N is the number of bytes required to make the final block of data the same size as the block size.
func PaddingZero ¶
PaddingZero add padding at the end of byte slice with byte 0.
Types ¶
type PaddingType ¶
type PaddingType uint8
PaddingType is the padding method such as PKCS7.
const ( // ISO97971 add padding at the end of byte slice with zero bytes which are separated by 0x80. ISO97971 PaddingType = 1 + iota // No add no padding. No // PKCS5 is similar to PKCS7, but its block size is 8. PKCS5 // PKCS7 padding is a generalization of PKCS5 padding (also known as standard padding). PKCS7 padding works by // appending N bytes with the value of chr(N) , where N is the number of bytes required to make the final block of // data the same size as the block size. PKCS7 // Zero add padding at the end of byte slice with byte 0. Zero )