crypto

package
v1.0.4016 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: Apache-2.0 Imports: 46 Imported by: 12

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 added in v1.0.2001

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

块解密 Block Decrypt

func BlockEncrypt added in v1.0.2001

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

块加密 Block Encrypt

Types

type Config added in v1.0.2001

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

*

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

func NewConfig added in v1.0.2001

func NewConfig(c Cryptobin) Config

New Config

func (Config) Config added in v1.0.2001

func (this Config) Config() *tool.Config

获取额外配置 get extra Config

func (Config) Iv added in v1.0.2001

func (this Config) Iv() []byte

获取向量 get Iv

func (Config) Key added in v1.0.2001

func (this Config) Key() []byte

获取密钥 get Key

func (Config) Mode added in v1.0.2001

func (this Config) Mode() Mode

获取加密模式 get Mode

func (Config) Multiple added in v1.0.2001

func (this Config) Multiple() Multiple

获取加密类型 get Multiple

func (Config) Padding added in v1.0.2001

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 added in v1.0.1018

func NewCryptobin() Cryptobin

New Cryptobin

func (Cryptobin) Aes

func (this Cryptobin) Aes() Cryptobin

Aes

func (Cryptobin) AppendError added in v1.0.1026

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

添加错误 Append Error

func (Cryptobin) Aria added in v1.0.2013

func (this Cryptobin) Aria() Cryptobin

Aria key is 16, 24, or 32 bytes.

func (Cryptobin) BC added in v1.0.2038

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 added in v1.0.1032

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

CCM ccm nounce size, should be in [7,13]

func (Cryptobin) CCMWithTagSize added in v1.0.2056

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

CCMWithTagSize ccm nounce size, should be in [7,13]

func (Cryptobin) CFB

func (this Cryptobin) CFB() Cryptobin

密码反馈模式 CFB mode

func (Cryptobin) CFB1 added in v1.0.2006

func (this Cryptobin) CFB1() Cryptobin

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

func (Cryptobin) CFB128 added in v1.0.2006

func (this Cryptobin) CFB128() Cryptobin

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

func (Cryptobin) CFB8 added in v1.0.1021

func (this Cryptobin) CFB8() Cryptobin

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

func (Cryptobin) CTR

func (this Cryptobin) CTR() Cryptobin

计算器模式 CTR mode

func (Cryptobin) Camellia added in v1.0.2013

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 added in v1.0.1031

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) GCMWithTagSize added in v1.0.2056

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

GCMWithTagSize

func (Cryptobin) GetConfig

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

获取获取全部配置 Get Config

func (Cryptobin) GetData

func (this Cryptobin) GetData() []byte

获取数据 Get Data

func (Cryptobin) GetErrors added in v1.0.1026

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 added in v1.0.2018

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 added in v1.0.2038

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

HCTR

func (Cryptobin) Hight added in v1.0.2036

func (this Cryptobin) Hight() Cryptobin

Hight The key argument should be 16 bytes.

func (Cryptobin) ISO10126Padding

func (this Cryptobin) ISO10126Padding() Cryptobin

ISO10126 补码 ISO10126Padding

func (Cryptobin) ISO7816_4Padding

func (this Cryptobin) ISO7816_4Padding() Cryptobin

ISO7816_4 补码 ISO7816_4Padding

func (Cryptobin) ISO97971Padding added in v1.0.1026

func (this Cryptobin) ISO97971Padding() Cryptobin

ISO97971 补码 ISO97971Padding

func (Cryptobin) Idea added in v1.0.2013

func (this Cryptobin) Idea() Cryptobin

Idea

func (Cryptobin) Kasumi added in v1.0.2038

func (this Cryptobin) Kasumi() Cryptobin

Kasumi The key argument should be 16 bytes.

func (Cryptobin) Khazad added in v1.0.2038

func (this Cryptobin) Khazad() Cryptobin

Khazad The key argument should be 16 bytes.

func (Cryptobin) Kseed added in v1.0.2038

func (this Cryptobin) Kseed() Cryptobin

Kseed The key argument should be 16 bytes.

func (Cryptobin) Kuznyechik added in v1.0.2018

func (this Cryptobin) Kuznyechik() Cryptobin

Kuznyechik The key argument should be 32 bytes.

func (Cryptobin) Lea added in v1.0.2036

func (this Cryptobin) Lea() Cryptobin

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

func (Cryptobin) Misty1 added in v1.0.2054

func (this Cryptobin) Misty1() Cryptobin

Misty1 The key argument should be 16 bytes.

func (Cryptobin) ModeBy added in v1.0.2001

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

使用模式 use Mode By mode enum

func (Cryptobin) Multi2 added in v1.0.2038

func (this Cryptobin) Multi2(rounds int32) Cryptobin

Multi2 The key argument should be 40 bytes.

func (Cryptobin) MultipleBy added in v1.0.2001

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 added in v1.0.2025

func (this Cryptobin) OCFB(resync bool) Cryptobin

OpenPGP 反馈模式 OCFB mode

func (Cryptobin) OFB

func (this Cryptobin) OFB() Cryptobin

输出反馈模式 OFB mode

func (Cryptobin) OFB8 added in v1.0.1021

func (this Cryptobin) OFB8() Cryptobin

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

func (Cryptobin) OnError

func (this Cryptobin) OnError(fn ErrorFunc) Cryptobin

错误事件 On Error

func (Cryptobin) PBOC2Padding added in v1.0.2027

func (this Cryptobin) PBOC2Padding() Cryptobin

PBOC2 补码 PBOC2Padding

func (Cryptobin) PCBC added in v1.0.2007

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 added in v1.0.2001

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

使用补码算法 use Padding by padding enum

func (Cryptobin) Present added in v1.0.2039

func (this Cryptobin) Present() Cryptobin

Present The key argument should be 10 or 16 bytes.

func (Cryptobin) PutConfig added in v1.0.2001

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

设置一个配置 set one config

func (Cryptobin) RC2 added in v1.0.1032

func (this Cryptobin) RC2() Cryptobin

RC2

func (Cryptobin) RC4

func (this Cryptobin) RC4() Cryptobin

RC4

func (Cryptobin) RC4MD5 added in v1.0.2013

func (this Cryptobin) RC4MD5() Cryptobin

RC4MD5

func (Cryptobin) RC5 added in v1.0.1039

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

RC5

func (Cryptobin) RC6 added in v1.0.2033

func (this Cryptobin) RC6() Cryptobin

RC6

func (Cryptobin) Rijndael added in v1.0.2041

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 added in v1.0.2041

func (this Cryptobin) Rijndael128() Cryptobin

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

func (Cryptobin) Rijndael192 added in v1.0.2041

func (this Cryptobin) Rijndael192() Cryptobin

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

func (Cryptobin) Rijndael256 added in v1.0.2041

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 added in v1.0.2038

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 added in v1.0.2035

func (this Cryptobin) Saferplus() Cryptobin

Saferplus The key argument should be 8, 16 bytes.

func (Cryptobin) Seed added in v1.0.2013

func (this Cryptobin) Seed() Cryptobin

Seed The key argument should be 16 bytes.

func (Cryptobin) Serpent added in v1.0.2018

func (this Cryptobin) Serpent() Cryptobin

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

func (Cryptobin) SetConfig added in v1.0.1046

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

批量设置配置 set config map

func (Cryptobin) SetData added in v1.0.2001

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 added in v1.0.2001

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

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

func (Cryptobin) SetMultiple added in v1.0.2001

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

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

func (Cryptobin) SetPadding added in v1.0.2001

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

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

func (Cryptobin) SetParsedData added in v1.0.2001

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) TripleDes added in v1.0.1047

func (this Cryptobin) TripleDes() Cryptobin

TripleDes

func (Cryptobin) Trivium added in v1.0.2039

func (this Cryptobin) Trivium() Cryptobin

Trivium The key argument should be 10 bytes.

func (Cryptobin) Twine added in v1.0.2054

func (this Cryptobin) Twine() Cryptobin

Twine The key argument should be 10 or 16 bytes.

func (Cryptobin) TwoDes added in v1.0.2010

func (this Cryptobin) TwoDes() Cryptobin

TwoDes

func (Cryptobin) Twofish

func (this Cryptobin) Twofish() Cryptobin

Twofish

func (Cryptobin) WithConfig

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

设置配置 set config

func (Cryptobin) WithData

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

设置数据 set Data bytes

func (Cryptobin) WithErrors added in v1.0.1026

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 added in v1.0.2001

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

DataName interface

type DataSet added in v1.0.2001

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

*

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

func NewDataSet added in v1.0.2001

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

构造函数 New DataSet

func (*DataSet[N, M]) Add added in v1.0.2001

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

设置 add data

func (*DataSet[N, M]) All added in v1.0.2001

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

获取所有数据 get all data

func (*DataSet[N, M]) Clean added in v1.0.2001

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

清空数据 clear data

func (*DataSet[N, M]) Get added in v1.0.2001

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

获取数据 get data by name

func (*DataSet[N, M]) Has added in v1.0.2001

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

判断是否有数据 exists data by name

func (*DataSet[N, M]) Len added in v1.0.2001

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

获取数据长度 get data len

func (*DataSet[N, M]) Names added in v1.0.2001

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

数据名称列表 name list

func (*DataSet[N, M]) Remove added in v1.0.2001

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

删除数据 remove data by name

type EncryptAes added in v1.0.2001

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 added in v1.0.2001

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

解密 / Decrypt

func (EncryptAes) Encrypt added in v1.0.2001

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

加密 / Encrypt

type EncryptAria added in v1.0.2013

type EncryptAria struct{}

Aria key is 16, 24, or 32 bytes.

func (EncryptAria) Decrypt added in v1.0.2013

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

解密 / Decrypt

func (EncryptAria) Encrypt added in v1.0.2013

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

加密 / Encrypt

type EncryptBlowfish added in v1.0.2001

type EncryptBlowfish struct{}

func (EncryptBlowfish) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (EncryptBlowfish) Encrypt added in v1.0.2001

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

加密 / Encrypt

type EncryptCamellia added in v1.0.2013

type EncryptCamellia struct{}

Camellia key is 16, 24, or 32 bytes.

func (EncryptCamellia) Decrypt added in v1.0.2013

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

解密 / Decrypt

func (EncryptCamellia) Encrypt added in v1.0.2013

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

加密 / Encrypt

type EncryptCast5 added in v1.0.2001

type EncryptCast5 struct{}

func (EncryptCast5) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (EncryptCast5) Encrypt added in v1.0.2001

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

加密 / Encrypt

type EncryptChacha20 added in v1.0.2001

type EncryptChacha20 struct{}

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

func (EncryptChacha20) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (EncryptChacha20) Encrypt added in v1.0.2001

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

加密 / Encrypt

type EncryptChacha20poly1305 added in v1.0.2001

type EncryptChacha20poly1305 struct{}

32 bytes key

func (EncryptChacha20poly1305) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (EncryptChacha20poly1305) Encrypt added in v1.0.2001

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

加密 / Encrypt

type EncryptChacha20poly1305X added in v1.0.2001

type EncryptChacha20poly1305X struct{}

32 bytes key

func (EncryptChacha20poly1305X) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (EncryptChacha20poly1305X) Encrypt added in v1.0.2001

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

加密 / Encrypt

type EncryptDes added in v1.0.2001

type EncryptDes struct{}

func (EncryptDes) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (EncryptDes) Encrypt added in v1.0.2001

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

加密 / Encrypt

type EncryptGost added in v1.0.2018

type EncryptGost struct{}

Gost key is 32 bytes.

func (EncryptGost) Decrypt added in v1.0.2018

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

解密 / Decrypt

func (EncryptGost) Encrypt added in v1.0.2018

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

加密 / Encrypt

type EncryptHight added in v1.0.2036

type EncryptHight struct{}

The key argument should be 16 bytes.

func (EncryptHight) Decrypt added in v1.0.2036

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

解密 / Decrypt

func (EncryptHight) Encrypt added in v1.0.2036

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

加密 / Encrypt

type EncryptIdea added in v1.0.2013

type EncryptIdea struct{}

func (EncryptIdea) Decrypt added in v1.0.2013

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

解密 / Decrypt

func (EncryptIdea) Encrypt added in v1.0.2013

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

加密 / Encrypt

type EncryptKasumi added in v1.0.2038

type EncryptKasumi struct{}

The key argument should be 16 bytes.

func (EncryptKasumi) Decrypt added in v1.0.2038

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

解密 / Decrypt

func (EncryptKasumi) Encrypt added in v1.0.2038

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

加密 / Encrypt

type EncryptKhazad added in v1.0.2038

type EncryptKhazad struct{}

The key argument should be 16 bytes.

func (EncryptKhazad) Decrypt added in v1.0.2038

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

解密 / Decrypt

func (EncryptKhazad) Encrypt added in v1.0.2038

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

加密 / Encrypt

type EncryptKseed added in v1.0.2038

type EncryptKseed struct{}

The key argument should be 16 bytes.

func (EncryptKseed) Decrypt added in v1.0.2038

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

解密 / Decrypt

func (EncryptKseed) Encrypt added in v1.0.2038

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

加密 / Encrypt

type EncryptKuznyechik added in v1.0.2018

type EncryptKuznyechik struct{}

Kuznyechik key is 32 bytes.

func (EncryptKuznyechik) Decrypt added in v1.0.2018

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

解密 / Decrypt

func (EncryptKuznyechik) Encrypt added in v1.0.2018

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

加密 / Encrypt

type EncryptLea added in v1.0.2036

type EncryptLea struct{}

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

func (EncryptLea) Decrypt added in v1.0.2036

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

解密 / Decrypt

func (EncryptLea) Encrypt added in v1.0.2036

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

加密 / Encrypt

type EncryptMisty1 added in v1.0.2054

type EncryptMisty1 struct{}

The key argument should be 16 bytes.

func (EncryptMisty1) Decrypt added in v1.0.2054

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

解密 / Decrypt

func (EncryptMisty1) Encrypt added in v1.0.2054

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

加密 / Encrypt

type EncryptMulti2 added in v1.0.2038

type EncryptMulti2 struct{}

The key argument should be 40 bytes.

func (EncryptMulti2) Decrypt added in v1.0.2038

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

解密 / Decrypt

func (EncryptMulti2) Encrypt added in v1.0.2038

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

加密 / Encrypt

type EncryptPresent added in v1.0.2039

type EncryptPresent struct{}

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

func (EncryptPresent) Decrypt added in v1.0.2039

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

解密 / Decrypt

func (EncryptPresent) Encrypt added in v1.0.2039

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

加密 / Encrypt

type EncryptRC2 added in v1.0.2001

type EncryptRC2 struct{}

func (EncryptRC2) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (EncryptRC2) Encrypt added in v1.0.2001

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

加密 / Encrypt

type EncryptRC4 added in v1.0.2001

type EncryptRC4 struct{}

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

func (EncryptRC4) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (EncryptRC4) Encrypt added in v1.0.2001

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

加密 / Encrypt

type EncryptRC4MD5 added in v1.0.2013

type EncryptRC4MD5 struct{}

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

func (EncryptRC4MD5) Decrypt added in v1.0.2013

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

解密 / Decrypt

func (EncryptRC4MD5) Encrypt added in v1.0.2013

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

加密 / Encrypt

type EncryptRC5 added in v1.0.2001

type EncryptRC5 struct{}

func (EncryptRC5) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (EncryptRC5) Encrypt added in v1.0.2001

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

加密 / Encrypt

type EncryptRC6 added in v1.0.2033

type EncryptRC6 struct{}

func (EncryptRC6) Decrypt added in v1.0.2033

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

解密 / Decrypt

func (EncryptRC6) Encrypt added in v1.0.2033

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

加密 / Encrypt

type EncryptRijndael added in v1.0.2041

type EncryptRijndael struct{}

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

func (EncryptRijndael) Decrypt added in v1.0.2041

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

解密 / Decrypt

func (EncryptRijndael) Encrypt added in v1.0.2041

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

加密 / Encrypt

type EncryptRijndael128 added in v1.0.2041

type EncryptRijndael128 struct{}

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

func (EncryptRijndael128) Decrypt added in v1.0.2041

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

解密 / Decrypt

func (EncryptRijndael128) Encrypt added in v1.0.2041

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

加密 / Encrypt

type EncryptRijndael192 added in v1.0.2041

type EncryptRijndael192 struct{}

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

func (EncryptRijndael192) Decrypt added in v1.0.2041

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

解密 / Decrypt

func (EncryptRijndael192) Encrypt added in v1.0.2041

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

加密 / Encrypt

type EncryptRijndael256 added in v1.0.2041

type EncryptRijndael256 struct{}

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

func (EncryptRijndael256) Decrypt added in v1.0.2041

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

解密 / Decrypt

func (EncryptRijndael256) Encrypt added in v1.0.2041

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

加密 / Encrypt

type EncryptSM4 added in v1.0.2001

type EncryptSM4 struct{}

func (EncryptSM4) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (EncryptSM4) Encrypt added in v1.0.2001

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

加密 / Encrypt

type EncryptSafer added in v1.0.2038

type EncryptSafer struct{}

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

func (EncryptSafer) Decrypt added in v1.0.2038

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

解密 / Decrypt

func (EncryptSafer) Encrypt added in v1.0.2038

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

加密 / Encrypt

type EncryptSaferplus added in v1.0.2035

type EncryptSaferplus struct{}

Saferplus key is 8, 16 bytes.

func (EncryptSaferplus) Decrypt added in v1.0.2035

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

解密 / Decrypt

func (EncryptSaferplus) Encrypt added in v1.0.2035

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

加密 / Encrypt

type EncryptSeed added in v1.0.2013

type EncryptSeed struct{}

Seed key is 16 bytes.

func (EncryptSeed) Decrypt added in v1.0.2013

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

解密 / Decrypt

func (EncryptSeed) Encrypt added in v1.0.2013

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

加密 / Encrypt

type EncryptSerpent added in v1.0.2018

type EncryptSerpent struct{}

Serpent key is 16, 24, 32 bytes.

func (EncryptSerpent) Decrypt added in v1.0.2018

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

解密 / Decrypt

func (EncryptSerpent) Encrypt added in v1.0.2018

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

加密 / Encrypt

type EncryptTea added in v1.0.2001

type EncryptTea struct{}

func (EncryptTea) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (EncryptTea) Encrypt added in v1.0.2001

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

加密 / Encrypt

type EncryptTripleDes added in v1.0.2001

type EncryptTripleDes struct{}

func (EncryptTripleDes) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (EncryptTripleDes) Encrypt added in v1.0.2001

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

加密 / Encrypt

type EncryptTrivium added in v1.0.2039

type EncryptTrivium struct{}

The key argument should be 10 bytes.

func (EncryptTrivium) Decrypt added in v1.0.2039

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

解密 / Decrypt

func (EncryptTrivium) Encrypt added in v1.0.2039

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

加密 / Encrypt

type EncryptTwine added in v1.0.2054

type EncryptTwine struct{}

The key argument should be 10 or 16 bytes.

func (EncryptTwine) Decrypt added in v1.0.2054

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

解密 / Decrypt

func (EncryptTwine) Encrypt added in v1.0.2054

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

加密 / Encrypt

type EncryptTwoDes added in v1.0.2010

type EncryptTwoDes struct{}

func (EncryptTwoDes) Decrypt added in v1.0.2010

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

解密 / Decrypt

func (EncryptTwoDes) Encrypt added in v1.0.2010

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

加密 / Encrypt

type EncryptTwofish added in v1.0.2001

type EncryptTwofish struct{}

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

func (EncryptTwofish) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (EncryptTwofish) Encrypt added in v1.0.2001

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

加密 / Encrypt

type EncryptXtea added in v1.0.2001

type EncryptXtea struct{}

func (EncryptXtea) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (EncryptXtea) Encrypt added in v1.0.2001

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

加密 / Encrypt

type EncryptXts added in v1.0.2001

type EncryptXts struct{}

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

func (EncryptXts) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (EncryptXts) Encrypt added in v1.0.2001

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

加密 / Encrypt

type ErrorFunc

type ErrorFunc = func([]error)

错误方法 Error Func

type IEncrypt added in v1.0.2001

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

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

加密接口 Encrypt interface

type IMode added in v1.0.2001

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

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

模式接口 Mode interface

type IOption added in v1.0.2001

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() *tool.Config
}

配置接口 config interface

type IPadding added in v1.0.2001

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

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

填充接口 Padding interface

type ISO10126Paddinger added in v1.0.2001

type ISO10126Paddinger struct{}

func (ISO10126Paddinger) Padding added in v1.0.2001

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

Padding 补码模式 / padding type

func (ISO10126Paddinger) UnPadding added in v1.0.2006

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

UnPadding 补码模式 / unpadding type

type ISO7816_4Paddinger added in v1.0.2001

type ISO7816_4Paddinger struct{}

func (ISO7816_4Paddinger) Padding added in v1.0.2001

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

Padding 补码模式 / padding type

func (ISO7816_4Paddinger) UnPadding added in v1.0.2006

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

UnPadding 补码模式 / unpadding type

type ISO97971Paddinger added in v1.0.2001

type ISO97971Paddinger struct{}

func (ISO97971Paddinger) Padding added in v1.0.2001

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

Padding 补码模式 / padding type

func (ISO97971Paddinger) UnPadding added in v1.0.2006

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

UnPadding 补码模式 / unpadding type

type Mode added in v1.0.1045

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 added in v1.0.1045

func (this Mode) String() string

type ModeBC added in v1.0.2038

type ModeBC struct{}

func (ModeBC) Decrypt added in v1.0.2038

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

解密 / Decrypt

func (ModeBC) Encrypt added in v1.0.2038

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

加密 / Encrypt

type ModeCBC added in v1.0.2001

type ModeCBC struct{}

func (ModeCBC) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (ModeCBC) Encrypt added in v1.0.2001

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

加密 / Encrypt

type ModeCCM added in v1.0.2001

type ModeCCM struct{}

func (ModeCCM) Decrypt added in v1.0.2001

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 added in v1.0.2001

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

加密 / Encrypt

type ModeCFB added in v1.0.2001

type ModeCFB struct{}

func (ModeCFB) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (ModeCFB) Encrypt added in v1.0.2001

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

加密 / Encrypt

type ModeCFB1 added in v1.0.2006

type ModeCFB1 struct{}

func (ModeCFB1) Decrypt added in v1.0.2006

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

解密 / Decrypt

func (ModeCFB1) Encrypt added in v1.0.2006

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

加密 / Encrypt

type ModeCFB8 added in v1.0.2001

type ModeCFB8 struct{}

func (ModeCFB8) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (ModeCFB8) Encrypt added in v1.0.2001

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

加密 / Encrypt

type ModeCTR added in v1.0.2001

type ModeCTR struct{}

func (ModeCTR) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (ModeCTR) Encrypt added in v1.0.2001

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

加密 / Encrypt

type ModeECB added in v1.0.2001

type ModeECB struct{}

func (ModeECB) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (ModeECB) Encrypt added in v1.0.2001

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

加密 / Encrypt

type ModeGCM added in v1.0.2001

type ModeGCM struct{}

func (ModeGCM) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (ModeGCM) Encrypt added in v1.0.2001

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

加密 / Encrypt

type ModeHCTR added in v1.0.2038

type ModeHCTR struct{}

func (ModeHCTR) Decrypt added in v1.0.2038

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

解密 / Decrypt

func (ModeHCTR) Encrypt added in v1.0.2038

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

加密 / Encrypt

type ModeOCFB added in v1.0.2025

type ModeOCFB struct{}

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

func (ModeOCFB) Decrypt added in v1.0.2025

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

解密 / Decrypt

func (ModeOCFB) Encrypt added in v1.0.2025

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

加密 / Encrypt

type ModeOFB added in v1.0.2001

type ModeOFB struct{}

func (ModeOFB) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (ModeOFB) Encrypt added in v1.0.2001

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

加密 / Encrypt

type ModeOFB8 added in v1.0.2001

type ModeOFB8 struct{}

func (ModeOFB8) Decrypt added in v1.0.2001

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

解密 / Decrypt

func (ModeOFB8) Encrypt added in v1.0.2001

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

加密 / Encrypt

type ModePCBC added in v1.0.2007

type ModePCBC struct{}

func (ModePCBC) Decrypt added in v1.0.2007

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

解密 / Decrypt

func (ModePCBC) Encrypt added in v1.0.2007

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

加密 / Encrypt

type Multiple added in v1.0.1045

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 added in v1.0.1045

func (this Multiple) String() string

type NoPaddinger added in v1.0.2001

type NoPaddinger struct{}

func (NoPaddinger) Padding added in v1.0.2001

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

Padding 补码模式 / padding type

func (NoPaddinger) UnPadding added in v1.0.2006

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

UnPadding 补码模式 / unpadding type

type PBOC2Paddinger added in v1.0.2027

type PBOC2Paddinger struct{}

func (PBOC2Paddinger) Padding added in v1.0.2027

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

Padding 补码模式 / padding type

func (PBOC2Paddinger) UnPadding added in v1.0.2027

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

UnPadding 补码模式 / unpadding type

type PKCS5Paddinger added in v1.0.2001

type PKCS5Paddinger struct{}

func (PKCS5Paddinger) Padding added in v1.0.2001

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

Padding 补码模式 / padding type

func (PKCS5Paddinger) UnPadding added in v1.0.2006

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

UnPadding 补码模式 / unpadding type

type PKCS7Paddinger added in v1.0.2001

type PKCS7Paddinger struct{}

func (PKCS7Paddinger) Padding added in v1.0.2001

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

Padding 补码模式 / padding type

func (PKCS7Paddinger) UnPadding added in v1.0.2006

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

UnPadding 补码模式 / unpadding type

type Padding added in v1.0.1045

type Padding uint

补码类型 Padding type

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

func (Padding) String added in v1.0.1045

func (this Padding) String() string

type TBCPaddinger added in v1.0.2001

type TBCPaddinger struct{}

func (TBCPaddinger) Padding added in v1.0.2001

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

Padding 补码模式 / padding type

func (TBCPaddinger) UnPadding added in v1.0.2006

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

UnPadding 补码模式 / unpadding type

type TypeName added in v1.0.2001

type TypeName interface {
	~uint | ~int
}

名称类型 Type Name

type TypeSet added in v1.0.2001

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

类型数据 Type Set

func NewTypeSet added in v1.0.2001

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

构造函数 New TypeSet

func (*TypeSet[N, D]) Generate added in v1.0.2001

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

生成新序列 Generate new id

func (*TypeSet[N, D]) Names added in v1.0.2001

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

类型名称列表 name list

type X923Paddinger added in v1.0.2001

type X923Paddinger struct{}

func (X923Paddinger) Padding added in v1.0.2001

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

Padding 补码模式 / padding type

func (X923Paddinger) UnPadding added in v1.0.2006

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

UnPadding 补码模式 / unpadding type

type ZeroPaddinger added in v1.0.2001

type ZeroPaddinger struct{}

func (ZeroPaddinger) Padding added in v1.0.2001

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

Padding 补码模式 / padding type

func (ZeroPaddinger) UnPadding added in v1.0.2006

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