crypto

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: Apache-2.0 Imports: 53 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TypeMode = NewTypeSet[Mode, string](maxMode)

模式 Type Mode

View Source
var TypeMultiple = NewTypeSet[Multiple, string](maxMultiple)

类型 Type Multiple

View Source
var TypePadding = NewTypeSet[Padding, string](maxPadding)

补码 Type Padding

View Source
var UseEncrypt = NewDataSet[Multiple, IEncrypt]()

加密类型 Encrypt Type

View Source
var UseMode = NewDataSet[Mode, IMode]()

模式 Encrypt Mode

View Source
var UsePadding = NewDataSet[Padding, IPadding]()

补码 Encrypt Padding

Functions

func BlockDecrypt

func BlockDecrypt(block cipher.Block, data []byte, opt IOption) ([]byte, error)

块解密 Block Decrypt

func BlockEncrypt

func BlockEncrypt(block cipher.Block, data []byte, opt IOption) ([]byte, error)

块加密 Block Encrypt

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

*

  • 配置 / Config *
  • @create 2023-3-30
  • @author deatil

func NewConfig

func NewConfig(c Cryptobin) Config

New Config

func (Config) Config

func (this Config) Config() *config.Config

获取额外配置 get extra Config

func (Config) Iv

func (this Config) Iv() []byte

获取向量 get Iv

func (Config) Key

func (this Config) Key() []byte

获取密钥 get Key

func (Config) Mode

func (this Config) Mode() Mode

获取加密模式 get Mode

func (Config) Multiple

func (this Config) Multiple() Multiple

获取加密类型 get Multiple

func (Config) Padding

func (this Config) Padding() Padding

获取补码 get Padding

type Cryptobin

type Cryptobin struct {

	// 错误 / error list
	Errors []error
	// contains filtered or unexported fields
}

*

  • Cryptobin *
  • @create 2022-3-19
  • @author deatil

func FromBase64String

func FromBase64String(data string) Cryptobin

设置数据 Base64 set data Base64

func FromBytes

func FromBytes(data []byte) Cryptobin

设置数据字节 set data bytes

func FromHexString

func FromHexString(data string) Cryptobin

设置数据 Hex set data Hex

func FromString

func FromString(data string) Cryptobin

设置数据字符 set data string

func New

func New() Cryptobin

构造函数 New Cryptobin

func NewCryptobin

func NewCryptobin() Cryptobin

New Cryptobin

func (Cryptobin) Aes

func (this Cryptobin) Aes() Cryptobin

Aes

func (Cryptobin) AppendError

func (this Cryptobin) AppendError(err ...error) Cryptobin

添加错误 Append Error

func (Cryptobin) AppendTriggerError

func (this Cryptobin) AppendTriggerError(err ...error) Cryptobin

Append Trigger Error

func (Cryptobin) Aria

func (this Cryptobin) Aria() Cryptobin

Aria key is 16, 24, or 32 bytes.

func (Cryptobin) BC

func (this Cryptobin) BC() Cryptobin

BC

func (Cryptobin) Blowfish

func (this Cryptobin) Blowfish(salt ...string) Cryptobin

Blowfish

func (Cryptobin) CBC

func (this Cryptobin) CBC() Cryptobin

密码分组链接模式 CBC mode

func (Cryptobin) CCM

func (this Cryptobin) CCM(additional ...[]byte) Cryptobin

CCM

func (Cryptobin) CCMWithNonceAndTagSize

func (this Cryptobin) CCMWithNonceAndTagSize(nonceSize, tagSize int, additional ...[]byte) Cryptobin

CCMWithNonceSize

func (Cryptobin) CCMWithNonceSize

func (this Cryptobin) CCMWithNonceSize(nonceSize int, additional ...[]byte) Cryptobin

CCMWithNonceSize ccm nonce size, should be in [7,13]

func (Cryptobin) CCMWithTagSize

func (this Cryptobin) CCMWithTagSize(tagSize int, additional ...[]byte) Cryptobin

CCMWithTagSize Tag sizes between 8 and 16 bytes are allowed.

func (Cryptobin) CFB

func (this Cryptobin) CFB() Cryptobin

密码反馈模式 CFB mode

func (Cryptobin) CFB1

func (this Cryptobin) CFB1() Cryptobin

密码反馈模式, 1字节 CFB1 mode

func (Cryptobin) CFB8

func (this Cryptobin) CFB8() Cryptobin

密码反馈模式, 8字节 CFB8 mode

func (Cryptobin) CFB128

func (this Cryptobin) CFB128() Cryptobin

密码反馈模式, 标准库 CFB 别名 CFB128 mode

func (Cryptobin) CTR

func (this Cryptobin) CTR() Cryptobin

计算器模式 CTR mode

func (Cryptobin) Camellia

func (this Cryptobin) Camellia() Cryptobin

Camellia The key argument should be 16, 24, or 32 bytes.

func (Cryptobin) Cast5

func (this Cryptobin) Cast5() Cryptobin

Cast5

func (Cryptobin) Chacha20

func (this Cryptobin) Chacha20(counter ...uint32) Cryptobin

Chacha20 | Chacha20IETF | XChacha20

func (Cryptobin) Chacha20poly1305

func (this Cryptobin) Chacha20poly1305(additional ...[]byte) Cryptobin

Chacha20poly1305 nonce is 12 bytes

func (Cryptobin) Chacha20poly1305X

func (this Cryptobin) Chacha20poly1305X(additional ...[]byte) Cryptobin

Chacha20poly1305X nonce is 24 bytes

func (Cryptobin) Decrypt

func (this Cryptobin) Decrypt() Cryptobin

解密 Decrypt

func (Cryptobin) Des

func (this Cryptobin) Des() Cryptobin

Des

func (Cryptobin) ECB

func (this Cryptobin) ECB() Cryptobin

电码本模式 ECB mode

func (Cryptobin) Encrypt

func (this Cryptobin) Encrypt() Cryptobin

加密 Encrypt

func (Cryptobin) Error

func (this Cryptobin) Error() error

获取错误 get error

func (Cryptobin) FromBase64String

func (this Cryptobin) FromBase64String(data string) Cryptobin

设置数据 Base64 set data Base64

func (Cryptobin) FromBytes

func (this Cryptobin) FromBytes(data []byte) Cryptobin

设置数据字节 set data bytes

func (Cryptobin) FromHexString

func (this Cryptobin) FromHexString(data string) Cryptobin

设置数据 Hex set data Hex

func (Cryptobin) FromString

func (this Cryptobin) FromString(data string) Cryptobin

设置数据字符 set data string

func (Cryptobin) FuncDecrypt

func (this Cryptobin) FuncDecrypt(fn func(Cryptobin) Cryptobin) Cryptobin

方法解密 Func Decrypt

func (Cryptobin) FuncEncrypt

func (this Cryptobin) FuncEncrypt(fn func(Cryptobin) Cryptobin) Cryptobin

方法加密 Func Encrypt

func (Cryptobin) GCM

func (this Cryptobin) GCM(additional ...[]byte) Cryptobin

GCM

func (Cryptobin) GCMWithNonceSize

func (this Cryptobin) GCMWithNonceSize(nonceSize int, additional ...[]byte) Cryptobin

GCMWithNonceSize

func (Cryptobin) GCMWithTagSize

func (this Cryptobin) GCMWithTagSize(tagSize int, additional ...[]byte) Cryptobin

GCMWithTagSize

func (Cryptobin) GetConfig

func (this Cryptobin) GetConfig() *config.Config

获取获取全部配置 Get Config

func (Cryptobin) GetData

func (this Cryptobin) GetData() []byte

获取数据 Get Data

func (Cryptobin) GetErrors

func (this Cryptobin) GetErrors() []error

获取错误信息 Get Error list

func (Cryptobin) GetIv

func (this Cryptobin) GetIv() []byte

获取向量 Get Iv

func (Cryptobin) GetKey

func (this Cryptobin) GetKey() []byte

获取密码 Get Key

func (Cryptobin) GetMode

func (this Cryptobin) GetMode() Mode

获取加密方式 Get Mode type

func (Cryptobin) GetMultiple

func (this Cryptobin) GetMultiple() Multiple

获取加密类型 Get Multiple type

func (Cryptobin) GetOneConfig

func (this Cryptobin) GetOneConfig(key string) any

获取获取一个配置 Get One Config

func (Cryptobin) GetPadding

func (this Cryptobin) GetPadding() Padding

获取补码算法 Get Padding

func (Cryptobin) GetParsedData

func (this Cryptobin) GetParsedData() []byte

获取解析后的数据 Get ParsedData

func (Cryptobin) Gost

func (this Cryptobin) Gost(sbox any) Cryptobin

Gost The key argument should be 32 bytes. sbox is [

SboxDESDerivedParamSet
SboxRFC4357TestParamSet
SboxGostR341194CryptoProParamSet
SboxTC26gost28147paramZ
SboxEACParamSet

] or set [][]byte data

func (Cryptobin) HCTR

func (this Cryptobin) HCTR(tweak, hkey []byte) Cryptobin

HCTR

func (Cryptobin) Hight

func (this Cryptobin) Hight() Cryptobin

Hight The key argument should be 16 bytes.

func (Cryptobin) ISO7816_4Padding

func (this Cryptobin) ISO7816_4Padding() Cryptobin

ISO7816_4 补码 ISO7816_4Padding

func (Cryptobin) ISO10126Padding

func (this Cryptobin) ISO10126Padding() Cryptobin

ISO10126 补码 ISO10126Padding

func (Cryptobin) ISO97971Padding

func (this Cryptobin) ISO97971Padding() Cryptobin

ISO97971 补码 ISO97971Padding

func (Cryptobin) Idea

func (this Cryptobin) Idea() Cryptobin

Idea

func (Cryptobin) Kasumi

func (this Cryptobin) Kasumi() Cryptobin

Kasumi The key argument should be 16 bytes.

func (Cryptobin) Khazad

func (this Cryptobin) Khazad() Cryptobin

Khazad The key argument should be 16 bytes.

func (Cryptobin) Kseed

func (this Cryptobin) Kseed() Cryptobin

Kseed The key argument should be 16 bytes.

func (Cryptobin) Kuznyechik

func (this Cryptobin) Kuznyechik() Cryptobin

Kuznyechik The key argument should be 32 bytes.

func (Cryptobin) Lea

func (this Cryptobin) Lea() Cryptobin

Lea The key argument should be 16, 24, 32 bytes.

func (Cryptobin) Misty1

func (this Cryptobin) Misty1() Cryptobin

Misty1 The key argument should be 16 bytes.

func (Cryptobin) ModeBy

func (this Cryptobin) ModeBy(mode Mode, cfg ...map[string]any) Cryptobin

使用模式 use Mode By mode enum

func (Cryptobin) Multi2

func (this Cryptobin) Multi2(rounds int32) Cryptobin

Multi2 The key argument should be 40 bytes.

func (Cryptobin) MultipleBy

func (this Cryptobin) MultipleBy(multiple Multiple, cfg ...map[string]any) Cryptobin

使用类型

func (Cryptobin) NoPadding

func (this Cryptobin) NoPadding() Cryptobin

不补码 NoPadding

func (Cryptobin) NoParse

func (this Cryptobin) NoParse() Cryptobin

不做处理 No Parse action to change data

func (Cryptobin) OCFB

func (this Cryptobin) OCFB(resync bool) Cryptobin

OpenPGP 反馈模式 OCFB mode

func (Cryptobin) OFB

func (this Cryptobin) OFB() Cryptobin

输出反馈模式 OFB mode

func (Cryptobin) OFB8

func (this Cryptobin) OFB8() Cryptobin

输出反馈模式, 8字节 OFB8 mode

func (Cryptobin) OnError

func (this Cryptobin) OnError(fn ErrorFunc) Cryptobin

错误事件 On Error

func (Cryptobin) PBOC2Padding

func (this Cryptobin) PBOC2Padding() Cryptobin

PBOC2 补码 PBOC2Padding

func (Cryptobin) PCBC

func (this Cryptobin) PCBC() Cryptobin

填充密码块链接模式 PCBC mode

func (Cryptobin) PKCS5Padding

func (this Cryptobin) PKCS5Padding() Cryptobin

PKCS5 补码 PKCS5Padding

func (Cryptobin) PKCS7Padding

func (this Cryptobin) PKCS7Padding() Cryptobin

PKCS7 补码 PKCS7Padding

func (Cryptobin) PaddingBy

func (this Cryptobin) PaddingBy(padding Padding, cfg ...map[string]any) Cryptobin

使用补码算法 use Padding by padding enum

func (Cryptobin) Present

func (this Cryptobin) Present() Cryptobin

Present The key argument should be 10 or 16 bytes.

func (Cryptobin) PutConfig

func (this Cryptobin) PutConfig(key string, value any) Cryptobin

设置一个配置 set one config

func (Cryptobin) RC2

func (this Cryptobin) RC2() Cryptobin

RC2

func (Cryptobin) RC4

func (this Cryptobin) RC4() Cryptobin

RC4

func (Cryptobin) RC4MD5

func (this Cryptobin) RC4MD5() Cryptobin

RC4MD5

func (Cryptobin) RC5

func (this Cryptobin) RC5(wordSize, rounds uint) Cryptobin

RC5

func (Cryptobin) RC6

func (this Cryptobin) RC6() Cryptobin

RC6

func (Cryptobin) Rijndael

func (this Cryptobin) Rijndael(blockSize int) Cryptobin

Rijndael The blockSize argument should be 16, 20, 24, 28 or 32 bytes. The key argument should be 16, 24 or 32 bytes.

func (Cryptobin) Rijndael128

func (this Cryptobin) Rijndael128() Cryptobin

Rijndael128 The key argument should be 16, 24 or 32 bytes.

func (Cryptobin) Rijndael192

func (this Cryptobin) Rijndael192() Cryptobin

Rijndael192 The key argument should be 16, 24 or 32 bytes.

func (Cryptobin) Rijndael256

func (this Cryptobin) Rijndael256() Cryptobin

Rijndael256 The key argument should be 16, 24 or 32 bytes.

func (Cryptobin) SM4

func (this Cryptobin) SM4() Cryptobin

SM4

func (Cryptobin) Safer

func (this Cryptobin) Safer(typ string, rounds int32) Cryptobin

Safer The typ should be K, SK string. The key argument should be 16, 24, 32 bytes.

func (Cryptobin) Saferplus

func (this Cryptobin) Saferplus() Cryptobin

Saferplus The key argument should be 8, 16 bytes.

func (Cryptobin) Seed

func (this Cryptobin) Seed() Cryptobin

Seed The key argument should be 16 bytes.

func (Cryptobin) Serpent

func (this Cryptobin) Serpent() Cryptobin

Serpent The key argument should be 16, 24, 32 bytes.

func (Cryptobin) SetConfig

func (this Cryptobin) SetConfig(data map[string]any) Cryptobin

批量设置配置 set config map

func (Cryptobin) SetData

func (this Cryptobin) SetData(data string) Cryptobin

设置数据 set Data string

func (Cryptobin) SetIv

func (this Cryptobin) SetIv(data string) Cryptobin

设置向量 set Key string

func (Cryptobin) SetKey

func (this Cryptobin) SetKey(data string) Cryptobin

密码 set Key string

func (Cryptobin) SetMode

func (this Cryptobin) SetMode(mode Mode, cfg map[string]any) Cryptobin

设置加密模式带参数 set mode type with config

func (Cryptobin) SetMultiple

func (this Cryptobin) SetMultiple(multiple Multiple, cfg map[string]any) Cryptobin

设置加密类型带参数 set Encrypt multiple with config

func (Cryptobin) SetPadding

func (this Cryptobin) SetPadding(padding Padding, cfg map[string]any) Cryptobin

设置补码方式带参数 set padding type with config

func (Cryptobin) SetParsedData

func (this Cryptobin) SetParsedData(data string) Cryptobin

设置解析后的数据 set parsedData string

func (Cryptobin) String

func (this Cryptobin) String() string

输出原始字符 output String

func (Cryptobin) TBCPadding

func (this Cryptobin) TBCPadding() Cryptobin

TBC 补码 TBCPadding

func (Cryptobin) Tea

func (this Cryptobin) Tea(rounds ...int) Cryptobin

Tea

func (Cryptobin) ToBase64String

func (this Cryptobin) ToBase64String() string

输出 Base64 output Base64 String

func (Cryptobin) ToBytes

func (this Cryptobin) ToBytes() []byte

输出字节 output Bytes

func (Cryptobin) ToHexString

func (this Cryptobin) ToHexString() string

输出 Hex output Hex String

func (Cryptobin) ToString

func (this Cryptobin) ToString() string

输出字符 output String

func (Cryptobin) TriggerError

func (this Cryptobin) TriggerError() Cryptobin

触发错误事件 trigger Error

func (Cryptobin) TripleDes

func (this Cryptobin) TripleDes() Cryptobin

TripleDes

func (Cryptobin) Trivium

func (this Cryptobin) Trivium() Cryptobin

Trivium The key argument should be 10 bytes.

func (Cryptobin) Twine

func (this Cryptobin) Twine() Cryptobin

Twine The key argument should be 10 or 16 bytes.

func (Cryptobin) TwoDes

func (this Cryptobin) TwoDes() Cryptobin

TwoDes

func (Cryptobin) Twofish

func (this Cryptobin) Twofish() Cryptobin

Twofish

func (Cryptobin) WithConfig

func (this Cryptobin) WithConfig(config *config.Config) Cryptobin

设置配置 set config

func (Cryptobin) WithData

func (this Cryptobin) WithData(data []byte) Cryptobin

设置数据 set Data bytes

func (Cryptobin) WithErrors

func (this Cryptobin) WithErrors(errs []error) Cryptobin

设置错误 set error list

func (Cryptobin) WithIv

func (this Cryptobin) WithIv(iv []byte) Cryptobin

设置向量 set Key bytes

func (Cryptobin) WithKey

func (this Cryptobin) WithKey(key []byte) Cryptobin

设置密钥 set Key bytes

func (Cryptobin) WithMode

func (this Cryptobin) WithMode(mode Mode) Cryptobin

设置加密方式 set mode type

func (Cryptobin) WithMultiple

func (this Cryptobin) WithMultiple(multiple Multiple) Cryptobin

设置加密类型 set Encrypt multiple

func (Cryptobin) WithPadding

func (this Cryptobin) WithPadding(padding Padding) Cryptobin

设置补码方式 set padding type

func (Cryptobin) WithParsedData

func (this Cryptobin) WithParsedData(data []byte) Cryptobin

设置解析后的数据 set parsedData bytes

func (Cryptobin) X923Padding

func (this Cryptobin) X923Padding() Cryptobin

X923 补码 X923Padding

func (Cryptobin) Xtea

func (this Cryptobin) Xtea() Cryptobin

Xtea

func (Cryptobin) Xts

func (this Cryptobin) Xts(cipher string, sectorNum uint64) Cryptobin

Xts cipher 可用 [ Aes | Des | TripleDes | Tea | Xtea | Twofish | Blowfish | Cast5 | SM4]

func (Cryptobin) ZeroPadding

func (this Cryptobin) ZeroPadding() Cryptobin

Zero 补码 ZeroPadding

type DataName

type DataName interface {
	~uint | ~int | ~string
}

DataName interface

type DataSet

type DataSet[N DataName, M any] struct {
	// contains filtered or unexported fields
}

*

  • 数据设置 / Data Set *
  • @create 2023-3-31
  • @author deatil

func NewDataSet

func NewDataSet[N DataName, M any]() *DataSet[N, M]

构造函数 New DataSet

func (*DataSet[N, M]) Add

func (this *DataSet[N, M]) Add(name N, data func() M) *DataSet[N, M]

设置 add data

func (*DataSet[N, M]) All

func (this *DataSet[N, M]) All() map[N]func() M

获取所有数据 get all data

func (*DataSet[N, M]) Clean

func (this *DataSet[N, M]) Clean()

清空数据 clear data

func (*DataSet[N, M]) Get

func (this *DataSet[N, M]) Get(name N) func() M

获取数据 get data by name

func (*DataSet[N, M]) Has

func (this *DataSet[N, M]) Has(name N) bool

判断是否有数据 exists data by name

func (*DataSet[N, M]) Len

func (this *DataSet[N, M]) Len() int

获取数据长度 get data len

func (*DataSet[N, M]) Names

func (this *DataSet[N, M]) Names() []N

数据名称列表 name list

func (*DataSet[N, M]) Remove

func (this *DataSet[N, M]) Remove(name N) *DataSet[N, M]

删除数据 remove data by name

type EncryptAes

type EncryptAes struct{}

NewCipher creates and returns a new cipher.Block. The key argument should be the AES key, either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.

func (EncryptAes) Decrypt

func (this EncryptAes) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptAes) Encrypt

func (this EncryptAes) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptAria

type EncryptAria struct{}

Aria key is 16, 24, or 32 bytes.

func (EncryptAria) Decrypt

func (this EncryptAria) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptAria) Encrypt

func (this EncryptAria) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptBlowfish

type EncryptBlowfish struct{}

func (EncryptBlowfish) Decrypt

func (this EncryptBlowfish) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptBlowfish) Encrypt

func (this EncryptBlowfish) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptCamellia

type EncryptCamellia struct{}

Camellia key is 16, 24, or 32 bytes.

func (EncryptCamellia) Decrypt

func (this EncryptCamellia) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptCamellia) Encrypt

func (this EncryptCamellia) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptCast5

type EncryptCast5 struct{}

func (EncryptCast5) Decrypt

func (this EncryptCast5) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptCast5) Encrypt

func (this EncryptCast5) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptChacha20

type EncryptChacha20 struct{}

32 bytes key and a 12 or 24 bytes nonce(iv)

func (EncryptChacha20) Decrypt

func (this EncryptChacha20) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptChacha20) Encrypt

func (this EncryptChacha20) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptChacha20poly1305

type EncryptChacha20poly1305 struct{}

32 bytes key and 12 bytes nonce

func (EncryptChacha20poly1305) Decrypt

func (this EncryptChacha20poly1305) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptChacha20poly1305) Encrypt

func (this EncryptChacha20poly1305) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptChacha20poly1305X

type EncryptChacha20poly1305X struct{}

32 bytes key and 24 bytes nonce

func (EncryptChacha20poly1305X) Decrypt

func (this EncryptChacha20poly1305X) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptChacha20poly1305X) Encrypt

func (this EncryptChacha20poly1305X) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptDes

type EncryptDes struct{}

func (EncryptDes) Decrypt

func (this EncryptDes) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptDes) Encrypt

func (this EncryptDes) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptGost

type EncryptGost struct{}

Gost key is 32 bytes.

func (EncryptGost) Decrypt

func (this EncryptGost) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptGost) Encrypt

func (this EncryptGost) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptHight

type EncryptHight struct{}

The key argument should be 16 bytes.

func (EncryptHight) Decrypt

func (this EncryptHight) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptHight) Encrypt

func (this EncryptHight) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptIdea

type EncryptIdea struct{}

func (EncryptIdea) Decrypt

func (this EncryptIdea) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptIdea) Encrypt

func (this EncryptIdea) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptKasumi

type EncryptKasumi struct{}

The key argument should be 16 bytes.

func (EncryptKasumi) Decrypt

func (this EncryptKasumi) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptKasumi) Encrypt

func (this EncryptKasumi) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptKhazad

type EncryptKhazad struct{}

The key argument should be 16 bytes.

func (EncryptKhazad) Decrypt

func (this EncryptKhazad) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptKhazad) Encrypt

func (this EncryptKhazad) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptKseed

type EncryptKseed struct{}

The key argument should be 16 bytes.

func (EncryptKseed) Decrypt

func (this EncryptKseed) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptKseed) Encrypt

func (this EncryptKseed) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptKuznyechik

type EncryptKuznyechik struct{}

Kuznyechik key is 32 bytes.

func (EncryptKuznyechik) Decrypt

func (this EncryptKuznyechik) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptKuznyechik) Encrypt

func (this EncryptKuznyechik) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptLea

type EncryptLea struct{}

The key argument should be 16, 24, 32 bytes.

func (EncryptLea) Decrypt

func (this EncryptLea) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptLea) Encrypt

func (this EncryptLea) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptMisty1

type EncryptMisty1 struct{}

The key argument should be 16 bytes.

func (EncryptMisty1) Decrypt

func (this EncryptMisty1) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptMisty1) Encrypt

func (this EncryptMisty1) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptMulti2

type EncryptMulti2 struct{}

The key argument should be 40 bytes.

func (EncryptMulti2) Decrypt

func (this EncryptMulti2) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptMulti2) Encrypt

func (this EncryptMulti2) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptPresent

type EncryptPresent struct{}

The key argument should be 16, 20, 24, 28, 32, 36, and 40 bytes.

func (EncryptPresent) Decrypt

func (this EncryptPresent) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptPresent) Encrypt

func (this EncryptPresent) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptRC2

type EncryptRC2 struct{}

func (EncryptRC2) Decrypt

func (this EncryptRC2) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptRC2) Encrypt

func (this EncryptRC2) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptRC4

type EncryptRC4 struct{}

RC4 key, at least 1 byte and at most 256 bytes.

func (EncryptRC4) Decrypt

func (this EncryptRC4) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptRC4) Encrypt

func (this EncryptRC4) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptRC4MD5

type EncryptRC4MD5 struct{}

RC4 key, at least 1 byte and at most 256 bytes.

func (EncryptRC4MD5) Decrypt

func (this EncryptRC4MD5) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptRC4MD5) Encrypt

func (this EncryptRC4MD5) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptRC5

type EncryptRC5 struct{}

func (EncryptRC5) Decrypt

func (this EncryptRC5) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptRC5) Encrypt

func (this EncryptRC5) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptRC6

type EncryptRC6 struct{}

func (EncryptRC6) Decrypt

func (this EncryptRC6) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptRC6) Encrypt

func (this EncryptRC6) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptRijndael

type EncryptRijndael struct{}

The key argument should be 16, 24 or 32 bytes.

func (EncryptRijndael) Decrypt

func (this EncryptRijndael) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptRijndael) Encrypt

func (this EncryptRijndael) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptRijndael128

type EncryptRijndael128 struct{}

The key argument should be 16, 24 or 32 bytes.

func (EncryptRijndael128) Decrypt

func (this EncryptRijndael128) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptRijndael128) Encrypt

func (this EncryptRijndael128) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptRijndael192

type EncryptRijndael192 struct{}

The key argument should be 16, 24 or 32 bytes.

func (EncryptRijndael192) Decrypt

func (this EncryptRijndael192) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptRijndael192) Encrypt

func (this EncryptRijndael192) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptRijndael256

type EncryptRijndael256 struct{}

The key argument should be 16, 24 or 32 bytes.

func (EncryptRijndael256) Decrypt

func (this EncryptRijndael256) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptRijndael256) Encrypt

func (this EncryptRijndael256) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptSM4

type EncryptSM4 struct{}

func (EncryptSM4) Decrypt

func (this EncryptSM4) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptSM4) Encrypt

func (this EncryptSM4) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptSafer

type EncryptSafer struct{}

The key argument should be 16, 24, 32 bytes.

func (EncryptSafer) Decrypt

func (this EncryptSafer) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptSafer) Encrypt

func (this EncryptSafer) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptSaferplus

type EncryptSaferplus struct{}

Saferplus key is 8, 16 bytes.

func (EncryptSaferplus) Decrypt

func (this EncryptSaferplus) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptSaferplus) Encrypt

func (this EncryptSaferplus) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptSeed

type EncryptSeed struct{}

Seed key is 16 bytes.

func (EncryptSeed) Decrypt

func (this EncryptSeed) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptSeed) Encrypt

func (this EncryptSeed) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptSerpent

type EncryptSerpent struct{}

Serpent key is 16, 24, 32 bytes.

func (EncryptSerpent) Decrypt

func (this EncryptSerpent) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptSerpent) Encrypt

func (this EncryptSerpent) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptTea

type EncryptTea struct{}

func (EncryptTea) Decrypt

func (this EncryptTea) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptTea) Encrypt

func (this EncryptTea) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptTripleDes

type EncryptTripleDes struct{}

func (EncryptTripleDes) Decrypt

func (this EncryptTripleDes) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptTripleDes) Encrypt

func (this EncryptTripleDes) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptTrivium

type EncryptTrivium struct{}

The key argument should be 10 bytes.

func (EncryptTrivium) Decrypt

func (this EncryptTrivium) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptTrivium) Encrypt

func (this EncryptTrivium) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptTwine

type EncryptTwine struct{}

The key argument should be 10 or 16 bytes.

func (EncryptTwine) Decrypt

func (this EncryptTwine) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptTwine) Encrypt

func (this EncryptTwine) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptTwoDes

type EncryptTwoDes struct{}

func (EncryptTwoDes) Decrypt

func (this EncryptTwoDes) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptTwoDes) Encrypt

func (this EncryptTwoDes) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptTwofish

type EncryptTwofish struct{}

The key argument should be the Twofish key, 16, 24 or 32 bytes.

func (EncryptTwofish) Decrypt

func (this EncryptTwofish) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptTwofish) Encrypt

func (this EncryptTwofish) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptXtea

type EncryptXtea struct{}

func (EncryptXtea) Decrypt

func (this EncryptXtea) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptXtea) Encrypt

func (this EncryptXtea) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type EncryptXts

type EncryptXts struct{}

Sectors must be a multiple of 16 bytes and less than 2²⁴ bytes.

func (EncryptXts) Decrypt

func (this EncryptXts) Decrypt(data []byte, opt IOption) ([]byte, error)

解密 / Decrypt

func (EncryptXts) Encrypt

func (this EncryptXts) Encrypt(data []byte, opt IOption) ([]byte, error)

加密 / Encrypt

type ErrorFunc

type ErrorFunc = func([]error)

错误方法 Error Func

type IEncrypt

type IEncrypt interface {
	// 加密
	// Encrypt
	Encrypt([]byte, IOption) ([]byte, error)

	// 解密
	// Decrypt
	Decrypt([]byte, IOption) ([]byte, error)
}

加密接口 Encrypt interface

type IMode

type IMode interface {
	// 加密
	// Encrypt
	Encrypt([]byte, cipher.Block, IOption) ([]byte, error)

	// 解密
	// Decrypt
	Decrypt([]byte, cipher.Block, IOption) ([]byte, error)
}

模式接口 Mode interface

type IOption

type IOption interface {
	// 密钥
	// get Key
	Key() []byte

	// 向量
	// get Iv
	Iv() []byte

	// 加密类型
	// get Multiple
	Multiple() Multiple

	// 加密模式
	// get Mode
	Mode() Mode

	// 填充模式
	// get Padding
	Padding() Padding

	// 额外配置
	// get extra Config
	Config() *config.Config
}

配置接口 config interface

type IPadding

type IPadding interface {
	// 补码
	// Padding
	Padding([]byte, int, IOption) []byte

	// 解密
	// UnPadding
	UnPadding([]byte, IOption) ([]byte, error)
}

填充接口 Padding interface

type ISO7816_4Paddinger

type ISO7816_4Paddinger struct{}

func (ISO7816_4Paddinger) Padding

func (this ISO7816_4Paddinger) Padding(plainText []byte, blockSize int, opt IOption) []byte

Padding 补码模式 / padding type

func (ISO7816_4Paddinger) UnPadding

func (this ISO7816_4Paddinger) UnPadding(cipherText []byte, opt IOption) ([]byte, error)

UnPadding 补码模式 / unpadding type

type ISO10126Paddinger

type ISO10126Paddinger struct{}

func (ISO10126Paddinger) Padding

func (this ISO10126Paddinger) Padding(plainText []byte, blockSize int, opt IOption) []byte

Padding 补码模式 / padding type

func (ISO10126Paddinger) UnPadding

func (this ISO10126Paddinger) UnPadding(cipherText []byte, opt IOption) ([]byte, error)

UnPadding 补码模式 / unpadding type

type ISO97971Paddinger

type ISO97971Paddinger struct{}

func (ISO97971Paddinger) Padding

func (this ISO97971Paddinger) Padding(plainText []byte, blockSize int, opt IOption) []byte

Padding 补码模式 / padding type

func (ISO97971Paddinger) UnPadding

func (this ISO97971Paddinger) UnPadding(cipherText []byte, opt IOption) ([]byte, error)

UnPadding 补码模式 / unpadding type

type Mode

type Mode uint

加密模式 Mode type

const (
	ECB Mode = 1 + iota
	CBC
	PCBC
	CFB
	CFB1
	CFB8
	CFB128
	OCFB
	OFB
	OFB8
	CTR
	GCM
	CCM
	BC
	HCTR
)

func (Mode) String

func (this Mode) String() string

type ModeBC

type ModeBC struct{}

func (ModeBC) Decrypt

func (this ModeBC) Decrypt(data []byte, block cipher.Block, opt IOption) ([]byte, error)

解密 / Decrypt

func (ModeBC) Encrypt

func (this ModeBC) Encrypt(plain []byte, block cipher.Block, opt IOption) ([]byte, error)

加密 / Encrypt

type ModeCBC

type ModeCBC struct{}

func (ModeCBC) Decrypt

func (this ModeCBC) Decrypt(data []byte, block cipher.Block, opt IOption) ([]byte, error)

解密 / Decrypt

func (ModeCBC) Encrypt

func (this ModeCBC) Encrypt(plain []byte, block cipher.Block, opt IOption) ([]byte, error)

加密 / Encrypt

type ModeCCM

type ModeCCM struct{}

func (ModeCCM) Decrypt

func (this ModeCCM) Decrypt(data []byte, block cipher.Block, opt IOption) ([]byte, error)

解密 / Decrypt ccm nounce size, should be in [7,13]

func (ModeCCM) Encrypt

func (this ModeCCM) Encrypt(plain []byte, block cipher.Block, opt IOption) ([]byte, error)

加密 / Encrypt

type ModeCFB

type ModeCFB struct{}

func (ModeCFB) Decrypt

func (this ModeCFB) Decrypt(data []byte, block cipher.Block, opt IOption) ([]byte, error)

解密 / Decrypt

func (ModeCFB) Encrypt

func (this ModeCFB) Encrypt(plain []byte, block cipher.Block, opt IOption) ([]byte, error)

加密 / Encrypt

type ModeCFB1

type ModeCFB1 struct{}

func (ModeCFB1) Decrypt

func (this ModeCFB1) Decrypt(data []byte, block cipher.Block, opt IOption) ([]byte, error)

解密 / Decrypt

func (ModeCFB1) Encrypt

func (this ModeCFB1) Encrypt(plain []byte, block cipher.Block, opt IOption) ([]byte, error)

加密 / Encrypt

type ModeCFB8

type ModeCFB8 struct{}

func (ModeCFB8) Decrypt

func (this ModeCFB8) Decrypt(data []byte, block cipher.Block, opt IOption) ([]byte, error)

解密 / Decrypt

func (ModeCFB8) Encrypt

func (this ModeCFB8) Encrypt(plain []byte, block cipher.Block, opt IOption) ([]byte, error)

加密 / Encrypt

type ModeCTR

type ModeCTR struct{}

func (ModeCTR) Decrypt

func (this ModeCTR) Decrypt(data []byte, block cipher.Block, opt IOption) ([]byte, error)

解密 / Decrypt

func (ModeCTR) Encrypt

func (this ModeCTR) Encrypt(plain []byte, block cipher.Block, opt IOption) ([]byte, error)

加密 / Encrypt

type ModeECB

type ModeECB struct{}

func (ModeECB) Decrypt

func (this ModeECB) Decrypt(data []byte, block cipher.Block, opt IOption) ([]byte, error)

解密 / Decrypt

func (ModeECB) Encrypt

func (this ModeECB) Encrypt(plain []byte, block cipher.Block, opt IOption) ([]byte, error)

加密 / Encrypt

type ModeGCM

type ModeGCM struct{}

func (ModeGCM) Decrypt

func (this ModeGCM) Decrypt(data []byte, block cipher.Block, opt IOption) ([]byte, error)

解密 / Decrypt

func (ModeGCM) Encrypt

func (this ModeGCM) Encrypt(plain []byte, block cipher.Block, opt IOption) ([]byte, error)

加密 / Encrypt

type ModeHCTR

type ModeHCTR struct{}

func (ModeHCTR) Decrypt

func (this ModeHCTR) Decrypt(data []byte, block cipher.Block, opt IOption) ([]byte, error)

解密 / Decrypt

func (ModeHCTR) Encrypt

func (this ModeHCTR) Encrypt(plain []byte, block cipher.Block, opt IOption) ([]byte, error)

加密 / Encrypt

type ModeOCFB

type ModeOCFB struct{}

OCFB 模式不需要补码 默认 prefix 放置在结果数据之前 OCFB not need padding and return [prefix + encrypted]

func (ModeOCFB) Decrypt

func (this ModeOCFB) Decrypt(data []byte, block cipher.Block, opt IOption) ([]byte, error)

解密 / Decrypt

func (ModeOCFB) Encrypt

func (this ModeOCFB) Encrypt(plain []byte, block cipher.Block, opt IOption) ([]byte, error)

加密 / Encrypt

type ModeOFB

type ModeOFB struct{}

func (ModeOFB) Decrypt

func (this ModeOFB) Decrypt(data []byte, block cipher.Block, opt IOption) ([]byte, error)

解密 / Decrypt

func (ModeOFB) Encrypt

func (this ModeOFB) Encrypt(plain []byte, block cipher.Block, opt IOption) ([]byte, error)

加密 / Encrypt

type ModeOFB8

type ModeOFB8 struct{}

func (ModeOFB8) Decrypt

func (this ModeOFB8) Decrypt(data []byte, block cipher.Block, opt IOption) ([]byte, error)

解密 / Decrypt

func (ModeOFB8) Encrypt

func (this ModeOFB8) Encrypt(plain []byte, block cipher.Block, opt IOption) ([]byte, error)

加密 / Encrypt

type ModePCBC

type ModePCBC struct{}

func (ModePCBC) Decrypt

func (this ModePCBC) Decrypt(data []byte, block cipher.Block, opt IOption) ([]byte, error)

解密 / Decrypt

func (ModePCBC) Encrypt

func (this ModePCBC) Encrypt(plain []byte, block cipher.Block, opt IOption) ([]byte, error)

加密 / Encrypt

type Multiple

type Multiple uint

加密类型 Multiple enum

const (
	Aes Multiple = 1 + iota
	Des
	TwoDes
	TripleDes
	Twofish
	Blowfish
	Tea
	Xtea
	Cast5
	RC2
	RC4
	RC4MD5
	RC5
	RC6
	Idea
	SM4
	Chacha20
	Chacha20poly1305
	Chacha20poly1305X
	Xts
	Seed
	Aria
	Camellia
	Gost
	Kuznyechik
	Serpent
	Saferplus
	Hight
	Lea
	Kasumi
	Safer
	Multi2
	Kseed
	Khazad
	Present
	Trivium
	Rijndael
	Rijndael128
	Rijndael192
	Rijndael256
	Twine
	Misty1
)

func (Multiple) String

func (this Multiple) String() string

type NoPaddinger

type NoPaddinger struct{}

func (NoPaddinger) Padding

func (this NoPaddinger) Padding(plainText []byte, blockSize int, opt IOption) []byte

Padding 补码模式 / padding type

func (NoPaddinger) UnPadding

func (this NoPaddinger) UnPadding(cipherText []byte, opt IOption) ([]byte, error)

UnPadding 补码模式 / unpadding type

type PBOC2Paddinger

type PBOC2Paddinger struct{}

func (PBOC2Paddinger) Padding

func (this PBOC2Paddinger) Padding(plainText []byte, blockSize int, opt IOption) []byte

Padding 补码模式 / padding type

func (PBOC2Paddinger) UnPadding

func (this PBOC2Paddinger) UnPadding(cipherText []byte, opt IOption) ([]byte, error)

UnPadding 补码模式 / unpadding type

type PKCS5Paddinger

type PKCS5Paddinger struct{}

func (PKCS5Paddinger) Padding

func (this PKCS5Paddinger) Padding(plainText []byte, blockSize int, opt IOption) []byte

Padding 补码模式 / padding type

func (PKCS5Paddinger) UnPadding

func (this PKCS5Paddinger) UnPadding(cipherText []byte, opt IOption) ([]byte, error)

UnPadding 补码模式 / unpadding type

type PKCS7Paddinger

type PKCS7Paddinger struct{}

func (PKCS7Paddinger) Padding

func (this PKCS7Paddinger) Padding(plainText []byte, blockSize int, opt IOption) []byte

Padding 补码模式 / padding type

func (PKCS7Paddinger) UnPadding

func (this PKCS7Paddinger) UnPadding(cipherText []byte, opt IOption) ([]byte, error)

UnPadding 补码模式 / unpadding type

type Padding

type Padding uint

补码类型 Padding type

const (
	NoPadding Padding = 1 + iota
	ZeroPadding
	PKCS5Padding
	PKCS7Padding
	X923Padding
	ISO10126Padding
	ISO7816_4Padding
	ISO97971Padding
	PBOC2Padding
	TBCPadding
)

func (Padding) String

func (this Padding) String() string

type TBCPaddinger

type TBCPaddinger struct{}

func (TBCPaddinger) Padding

func (this TBCPaddinger) Padding(plainText []byte, blockSize int, opt IOption) []byte

Padding 补码模式 / padding type

func (TBCPaddinger) UnPadding

func (this TBCPaddinger) UnPadding(cipherText []byte, opt IOption) ([]byte, error)

UnPadding 补码模式 / unpadding type

type TypeName

type TypeName interface {
	~uint | ~int
}

名称类型 Type Name

type TypeSet

type TypeSet[N TypeName, D any] struct {
	// contains filtered or unexported fields
}

类型数据 Type Set

func NewTypeSet

func NewTypeSet[N TypeName, D any](max N) *TypeSet[N, D]

构造函数 New TypeSet

func (*TypeSet[N, D]) Generate

func (this *TypeSet[N, D]) Generate() N

生成新序列 Generate new id

func (*TypeSet[N, D]) Names

func (this *TypeSet[N, D]) Names() *DataSet[N, D]

类型名称列表 name list

type X923Paddinger

type X923Paddinger struct{}

func (X923Paddinger) Padding

func (this X923Paddinger) Padding(plainText []byte, blockSize int, opt IOption) []byte

Padding 补码模式 / padding type

func (X923Paddinger) UnPadding

func (this X923Paddinger) UnPadding(cipherText []byte, opt IOption) ([]byte, error)

UnPadding 补码模式 / unpadding type

type ZeroPaddinger

type ZeroPaddinger struct{}

func (ZeroPaddinger) Padding

func (this ZeroPaddinger) Padding(plainText []byte, blockSize int, opt IOption) []byte

Padding 补码模式 / padding type

func (ZeroPaddinger) UnPadding

func (this ZeroPaddinger) UnPadding(cipherText []byte, opt IOption) ([]byte, error)

UnPadding 补码模式 / unpadding type

Jump to

Keyboard shortcuts

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