crypto

package
v1.0.2047 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AesCFB = TypeMultiple.Generate()
	AesECB = TypeMultiple.Generate()
)
View Source
var TypeMode = NewTypeSet[Mode, string](maxMode)

模式

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

类型

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

补码

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

加密解密

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

模式

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

补码

Functions

func AesECBGenerateKey added in v1.0.2025

func AesECBGenerateKey(key []byte) (genKey []byte)

AesECB key 处理

func BlockDecrypt added in v1.0.2001

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

解密

func BlockEncrypt added in v1.0.2001

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

加密

Types

type Config added in v1.0.2001

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

*

  • 包装配置 *
  • @create 2023-3-30
  • @author deatil

func NewConfig added in v1.0.2001

func NewConfig(c Cryptobin) Config

构造函数

func (Config) Config added in v1.0.2001

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

额外配置

func (Config) Iv added in v1.0.2001

func (this Config) Iv() []byte

向量

func (Config) Key added in v1.0.2001

func (this Config) Key() []byte

密钥

func (Config) Mode added in v1.0.2001

func (this Config) Mode() Mode

加密模式

func (Config) Multiple added in v1.0.2001

func (this Config) Multiple() Multiple

加密类型

func (Config) Padding added in v1.0.2001

func (this Config) Padding() Padding

填充模式

type Cryptobin

type Cryptobin struct {

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

*

  • 对称加密 *
  • @create 2022-3-19
  • @author deatil

func FromBase64String

func FromBase64String(data string) Cryptobin

Base64

func FromBytes

func FromBytes(data []byte) Cryptobin

字节

func FromHexString

func FromHexString(data string) Cryptobin

Hex

func FromString

func FromString(data string) Cryptobin

字符

func New

func New() Cryptobin

构造函数

func NewCryptobin added in v1.0.1018

func NewCryptobin() Cryptobin

构造函数

func (Cryptobin) Aes

func (this Cryptobin) Aes() Cryptobin

Aes

func (Cryptobin) AesCFB added in v1.0.2001

func (this Cryptobin) AesCFB() Cryptobin

特殊的 AesCFB 组合模式 也可以使用: MultipleBy(AesCFB)

func (Cryptobin) AesECB added in v1.0.2001

func (this Cryptobin) AesECB() Cryptobin

特殊的 AesECB 组合模式 也可以使用: MultipleBy(AesECB)

func (Cryptobin) Anubis added in v1.0.2038

func (this Cryptobin) Anubis() Cryptobin

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

func (Cryptobin) AppendError added in v1.0.1026

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

添加错误

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

密码分组链接模式

func (Cryptobin) CCM added in v1.0.1032

func (this Cryptobin) CCM(nonce string, additional ...string) Cryptobin

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

func (Cryptobin) CFB

func (this Cryptobin) CFB() Cryptobin

密码反馈模式

func (Cryptobin) CFB1 added in v1.0.2006

func (this Cryptobin) CFB1() Cryptobin

密码反馈模式

func (Cryptobin) CFB128 added in v1.0.2006

func (this Cryptobin) CFB128() Cryptobin

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

func (Cryptobin) CFB16 added in v1.0.2006

func (this Cryptobin) CFB16() Cryptobin

密码反馈模式

func (Cryptobin) CFB32 added in v1.0.2006

func (this Cryptobin) CFB32() Cryptobin

密码反馈模式

func (Cryptobin) CFB64 added in v1.0.2006

func (this Cryptobin) CFB64() Cryptobin

密码反馈模式

func (Cryptobin) CFB8 added in v1.0.1021

func (this Cryptobin) CFB8() Cryptobin

密码反馈模式, 8字节

func (Cryptobin) CTR

func (this Cryptobin) CTR() Cryptobin

计算器模式

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) Cast256 added in v1.0.2036

func (this Cryptobin) Cast256() Cryptobin

Cast256 The key argument should be 32 bytes.

func (Cryptobin) Cast5

func (this Cryptobin) Cast5() Cryptobin

Cast5

func (Cryptobin) Chacha20

func (this Cryptobin) Chacha20(nonce string, counter ...uint32) Cryptobin

Chacha20 | Chacha20IETF | XChacha20

func (Cryptobin) Chacha20poly1305

func (this Cryptobin) Chacha20poly1305(nonce string, additional string) Cryptobin

Chacha20poly1305 nonce is 12 bytes

func (Cryptobin) Chacha20poly1305X added in v1.0.1031

func (this Cryptobin) Chacha20poly1305X(nonce string, additional string) Cryptobin

Chacha20poly1305X nonce is 24 bytes

func (Cryptobin) Clefia added in v1.0.2038

func (this Cryptobin) Clefia() Cryptobin

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

func (Cryptobin) Crypton1 added in v1.0.2038

func (this Cryptobin) Crypton1() Cryptobin

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

func (Cryptobin) Decrypt

func (this Cryptobin) Decrypt() Cryptobin

解密

func (Cryptobin) Des

func (this Cryptobin) Des() Cryptobin

Des

func (Cryptobin) E2 added in v1.0.2038

func (this Cryptobin) E2() Cryptobin

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

func (Cryptobin) EAX added in v1.0.2024

func (this Cryptobin) EAX(nonce string, additional ...string) Cryptobin

EAX EAX nounce size, should be in > 0

func (Cryptobin) ECB

func (this Cryptobin) ECB() Cryptobin

电码本模式

func (Cryptobin) Encrypt

func (this Cryptobin) Encrypt() Cryptobin

加密

func (Cryptobin) Enigma added in v1.0.2036

func (this Cryptobin) Enigma() Cryptobin

Enigma The key argument should be 13 bytes.

func (Cryptobin) Error

func (this Cryptobin) Error() error

获取错误

func (Cryptobin) FromBase64String

func (this Cryptobin) FromBase64String(data string) Cryptobin

Base64

func (Cryptobin) FromBytes

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

字节

func (Cryptobin) FromHexString

func (this Cryptobin) FromHexString(data string) Cryptobin

Hex

func (Cryptobin) FromString

func (this Cryptobin) FromString(data string) Cryptobin

字符

func (Cryptobin) FuncDecrypt

func (this Cryptobin) FuncDecrypt(f func(Cryptobin) Cryptobin) Cryptobin

方法解密

func (Cryptobin) FuncEncrypt

func (this Cryptobin) FuncEncrypt(f func(Cryptobin) Cryptobin) Cryptobin

方法加密

func (Cryptobin) GCM

func (this Cryptobin) GCM(nonce string, additional ...string) Cryptobin

GCM

func (Cryptobin) GetConfig

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

获取全部配置

func (Cryptobin) GetData

func (this Cryptobin) GetData() []byte

数据

func (Cryptobin) GetErrors added in v1.0.1026

func (this Cryptobin) GetErrors() []error

错误信息

func (Cryptobin) GetIv

func (this Cryptobin) GetIv() []byte

向量

func (Cryptobin) GetKey

func (this Cryptobin) GetKey() []byte

密码

func (Cryptobin) GetMode

func (this Cryptobin) GetMode() Mode

加密方式

func (Cryptobin) GetMultiple

func (this Cryptobin) GetMultiple() Multiple

加密类型

func (Cryptobin) GetOneConfig

func (this Cryptobin) GetOneConfig(key string) any

获取一个配置

func (Cryptobin) GetPadding

func (this Cryptobin) GetPadding() Padding

补码算法

func (Cryptobin) GetParsedData

func (this Cryptobin) GetParsedData() []byte

解析后的数据

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 [DESDerivedSbox | TestSbox | CryptoProSbox | TC26Sbox | EACSbox] 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 补码

func (Cryptobin) ISO7816_4Padding

func (this Cryptobin) ISO7816_4Padding() Cryptobin

ISO7816_4 补码

func (Cryptobin) ISO97971Padding added in v1.0.1026

func (this Cryptobin) ISO97971Padding() Cryptobin

ISO97971 补码

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

func (this Cryptobin) Loki97() Cryptobin

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

func (Cryptobin) Magenta added in v1.0.2038

func (this Cryptobin) Magenta() Cryptobin

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

func (Cryptobin) Mars added in v1.0.2036

func (this Cryptobin) Mars() Cryptobin

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

func (Cryptobin) Mars2 added in v1.0.2039

func (this Cryptobin) Mars2() Cryptobin

Mars2 The key argument should be from 128 to 448 bits

func (Cryptobin) ModeBy added in v1.0.2001

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

使用模式

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

func (this Cryptobin) NCFB() Cryptobin

NCFB

func (Cryptobin) NOFB added in v1.0.2035

func (this Cryptobin) NOFB() Cryptobin

NOFB

func (Cryptobin) NoPadding

func (this Cryptobin) NoPadding() Cryptobin

不补码

func (Cryptobin) NoParse

func (this Cryptobin) NoParse() Cryptobin

不做处理

func (Cryptobin) Noekeon added in v1.0.2038

func (this Cryptobin) Noekeon() Cryptobin

Noekeon The key argument should be 16 bytes.

func (Cryptobin) OCB added in v1.0.2024

func (this Cryptobin) OCB(nonce string, additional ...string) Cryptobin

OCB OCB nounce size, should be in [0, cipher.block.BlockSize]

func (Cryptobin) OCFB added in v1.0.2025

func (this Cryptobin) OCFB(resync bool) Cryptobin

OpenPGP 反馈模式

func (Cryptobin) OFB

func (this Cryptobin) OFB() Cryptobin

输出反馈模式

func (Cryptobin) OFB8 added in v1.0.1021

func (this Cryptobin) OFB8() Cryptobin

输出反馈模式, 8字节

func (Cryptobin) OnError

func (this Cryptobin) OnError(fn ErrorFunc) Cryptobin

添加错误事件

func (Cryptobin) PBOC2Padding added in v1.0.2027

func (this Cryptobin) PBOC2Padding() Cryptobin

PBOC2 补码

func (Cryptobin) PCBC added in v1.0.2007

func (this Cryptobin) PCBC() Cryptobin

填充密码块链接模式

func (Cryptobin) PKCS1Padding

func (this Cryptobin) PKCS1Padding(bt ...string) Cryptobin

PKCS1 补码

func (Cryptobin) PKCS5Padding

func (this Cryptobin) PKCS5Padding() Cryptobin

PKCS5 补码

func (Cryptobin) PKCS7Padding

func (this Cryptobin) PKCS7Padding() Cryptobin

PKCS7 补码

func (Cryptobin) PaddingBy added in v1.0.2001

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

使用补码算法

func (Cryptobin) Panama added in v1.0.2036

func (this Cryptobin) Panama() Cryptobin

Panama The key argument should be 32 bytes.

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

设置一个配置

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) Salsa20 added in v1.0.2013

func (this Cryptobin) Salsa20(nonce string) Cryptobin

Salsa20 key is 32 bytes, nonce is 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

批量设置配置

func (Cryptobin) SetData added in v1.0.2001

func (this Cryptobin) SetData(data string) Cryptobin

设置数据

func (Cryptobin) SetIv

func (this Cryptobin) SetIv(data string) Cryptobin

向量

func (Cryptobin) SetKey

func (this Cryptobin) SetKey(data string) Cryptobin

密码

func (Cryptobin) SetMode added in v1.0.2001

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

设置加密模式带参数

func (Cryptobin) SetMultiple added in v1.0.2001

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

设置加密类型带参数

func (Cryptobin) SetPadding added in v1.0.2001

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

设置补码算法带参数

func (Cryptobin) SetParsedData added in v1.0.2001

func (this Cryptobin) SetParsedData(data string) Cryptobin

设置解析后的数据

func (Cryptobin) Skipjack added in v1.0.2018

func (this Cryptobin) Skipjack() Cryptobin

Skipjack The key argument should be 10 bytes.

func (Cryptobin) Square added in v1.0.2038

func (this Cryptobin) Square() Cryptobin

Square The key argument should be 32 bytes.

func (Cryptobin) String

func (this Cryptobin) String() string

输出原始字符

func (Cryptobin) TBCPadding

func (this Cryptobin) TBCPadding() Cryptobin

TBC 补码

func (Cryptobin) Tea

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

Tea

func (Cryptobin) ToBase64String

func (this Cryptobin) ToBase64String() string

输出Base64

func (Cryptobin) ToBytes

func (this Cryptobin) ToBytes() []byte

输出字节

func (Cryptobin) ToHexString

func (this Cryptobin) ToHexString() string

输出Hex

func (Cryptobin) ToString

func (this Cryptobin) ToString() 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) TwoDes added in v1.0.2010

func (this Cryptobin) TwoDes() Cryptobin

TwoDes

func (Cryptobin) Twofish

func (this Cryptobin) Twofish() Cryptobin

Twofish

func (Cryptobin) Wake added in v1.0.2036

func (this Cryptobin) Wake() Cryptobin

Wake The key argument should be 16 bytes.

func (Cryptobin) WithConfig

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

设置配置

func (Cryptobin) WithData

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

设置数据

func (Cryptobin) WithErrors added in v1.0.1026

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

设置错误

func (Cryptobin) WithIv

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

设置向量

func (Cryptobin) WithKey

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

设置密钥

func (Cryptobin) WithMode

func (this Cryptobin) WithMode(mode Mode) Cryptobin

加密方式

func (Cryptobin) WithMultiple

func (this Cryptobin) WithMultiple(multiple Multiple) Cryptobin

加密类型

func (Cryptobin) WithPadding

func (this Cryptobin) WithPadding(padding Padding) Cryptobin

补码算法

func (Cryptobin) WithParsedData

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

设置解析后的数据

func (Cryptobin) X923Padding

func (this Cryptobin) X923Padding() Cryptobin

X923 补码

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 补码

type DataName added in v1.0.2001

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

type DataSet added in v1.0.2001

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

*

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

func NewDataSet added in v1.0.2001

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

构造函数

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

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

设置

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

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

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

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

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

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

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

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

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

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

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

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

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

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

删除

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)

解密

func (EncryptAes) Encrypt added in v1.0.2001

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

加密

type EncryptAesCFB added in v1.0.2001

type EncryptAesCFB struct{}

func (EncryptAesCFB) Decrypt added in v1.0.2001

func (this EncryptAesCFB) Decrypt(encrypted []byte, opt IOption) ([]byte, error)

解密

func (EncryptAesCFB) Encrypt added in v1.0.2001

func (this EncryptAesCFB) Encrypt(origData []byte, opt IOption) ([]byte, error)

加密

type EncryptAesECB added in v1.0.2001

type EncryptAesECB struct{}

func (EncryptAesECB) Decrypt added in v1.0.2001

func (this EncryptAesECB) Decrypt(encrypted []byte, opt IOption) ([]byte, error)

func (EncryptAesECB) Encrypt added in v1.0.2001

func (this EncryptAesECB) Encrypt(origData []byte, opt IOption) ([]byte, error)

type EncryptAnubis added in v1.0.2038

type EncryptAnubis struct{}

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

func (EncryptAnubis) Decrypt added in v1.0.2038

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

解密

func (EncryptAnubis) Encrypt added in v1.0.2038

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

加密

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)

解密

func (EncryptAria) Encrypt added in v1.0.2013

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

加密

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)

解密

func (EncryptBlowfish) Encrypt added in v1.0.2001

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

加密

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)

解密

func (EncryptCamellia) Encrypt added in v1.0.2013

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

加密

type EncryptCast256 added in v1.0.2036

type EncryptCast256 struct{}

Cast256 key is 32 bytes.

func (EncryptCast256) Decrypt added in v1.0.2036

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

解密

func (EncryptCast256) Encrypt added in v1.0.2036

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

加密

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)

解密

func (EncryptCast5) Encrypt added in v1.0.2001

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

加密

type EncryptChacha20 added in v1.0.2001

type EncryptChacha20 struct{}

32 bytes key and a 12 or 24 bytes nonce

func (EncryptChacha20) Decrypt added in v1.0.2001

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

解密

func (EncryptChacha20) Encrypt added in v1.0.2001

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

加密

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)

解密

func (EncryptChacha20poly1305) Encrypt added in v1.0.2001

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

加密

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)

解密

func (EncryptChacha20poly1305X) Encrypt added in v1.0.2001

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

加密

type EncryptClefia added in v1.0.2038

type EncryptClefia struct{}

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

func (EncryptClefia) Decrypt added in v1.0.2038

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

解密

func (EncryptClefia) Encrypt added in v1.0.2038

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

加密

type EncryptCrypton1 added in v1.0.2038

type EncryptCrypton1 struct{}

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

func (EncryptCrypton1) Decrypt added in v1.0.2038

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

解密

func (EncryptCrypton1) Encrypt added in v1.0.2038

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

加密

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)

解密

func (EncryptDes) Encrypt added in v1.0.2001

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

加密

type EncryptE2 added in v1.0.2038

type EncryptE2 struct{}

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

func (EncryptE2) Decrypt added in v1.0.2038

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

解密

func (EncryptE2) Encrypt added in v1.0.2038

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

加密

type EncryptEnigma added in v1.0.2036

type EncryptEnigma struct{}

Enigma key is 13 bytes.

func (EncryptEnigma) Decrypt added in v1.0.2036

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

解密

func (EncryptEnigma) Encrypt added in v1.0.2036

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

加密

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)

解密

func (EncryptGost) Encrypt added in v1.0.2018

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

加密

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)

解密

func (EncryptHight) Encrypt added in v1.0.2036

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

加密

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)

解密

func (EncryptIdea) Encrypt added in v1.0.2013

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

加密

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)

解密

func (EncryptKasumi) Encrypt added in v1.0.2038

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

加密

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)

解密

func (EncryptKhazad) Encrypt added in v1.0.2038

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

加密

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)

解密

func (EncryptKseed) Encrypt added in v1.0.2038

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

加密

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)

解密

func (EncryptKuznyechik) Encrypt added in v1.0.2018

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

加密

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)

解密

func (EncryptLea) Encrypt added in v1.0.2036

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

加密

type EncryptLoki97 added in v1.0.2035

type EncryptLoki97 struct{}

Loki97 key is 16, 24, 32 bytes.

func (EncryptLoki97) Decrypt added in v1.0.2035

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

解密

func (EncryptLoki97) Encrypt added in v1.0.2035

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

加密

type EncryptMagenta added in v1.0.2038

type EncryptMagenta struct{}

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

func (EncryptMagenta) Decrypt added in v1.0.2038

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

解密

func (EncryptMagenta) Encrypt added in v1.0.2038

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

加密

type EncryptMars added in v1.0.2036

type EncryptMars struct{}

Mars key is 16, 24, 32 bytes.

func (EncryptMars) Decrypt added in v1.0.2036

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

解密

func (EncryptMars) Encrypt added in v1.0.2036

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

加密

type EncryptMars2 added in v1.0.2039

type EncryptMars2 struct{}

Mars key is 16, 24, 32 bytes.

func (EncryptMars2) Decrypt added in v1.0.2039

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

解密

func (EncryptMars2) Encrypt added in v1.0.2039

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

加密

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)

解密

func (EncryptMulti2) Encrypt added in v1.0.2038

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

加密

type EncryptNoekeon added in v1.0.2038

type EncryptNoekeon struct{}

The key argument should be 16 bytes.

func (EncryptNoekeon) Decrypt added in v1.0.2038

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

解密

func (EncryptNoekeon) Encrypt added in v1.0.2038

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

加密

type EncryptPanama added in v1.0.2036

type EncryptPanama struct{}

The key argument should be 32 bytes.

func (EncryptPanama) Decrypt added in v1.0.2036

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

解密

func (EncryptPanama) Encrypt added in v1.0.2036

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

加密

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)

解密

func (EncryptPresent) Encrypt added in v1.0.2039

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

加密

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)

解密

func (EncryptRC2) Encrypt added in v1.0.2001

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

加密

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)

解密

func (EncryptRC4) Encrypt added in v1.0.2001

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

加密

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)

解密

func (EncryptRC4MD5) Encrypt added in v1.0.2013

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

加密

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)

解密

func (EncryptRC5) Encrypt added in v1.0.2001

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

加密

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)

解密

func (EncryptRC6) Encrypt added in v1.0.2033

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

加密

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)

解密

func (EncryptRijndael) Encrypt added in v1.0.2041

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

加密

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)

解密

func (EncryptRijndael128) Encrypt added in v1.0.2041

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

加密

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)

解密

func (EncryptRijndael192) Encrypt added in v1.0.2041

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

加密

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)

解密

func (EncryptRijndael256) Encrypt added in v1.0.2041

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

加密

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)

解密

func (EncryptSM4) Encrypt added in v1.0.2001

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

加密

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)

解密

func (EncryptSafer) Encrypt added in v1.0.2038

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

加密

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)

解密

func (EncryptSaferplus) Encrypt added in v1.0.2035

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

加密

type EncryptSalsa20 added in v1.0.2013

type EncryptSalsa20 struct{}

Salsa20 key is 32 bytes. nonce is 16 bytes.

func (EncryptSalsa20) Decrypt added in v1.0.2013

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

解密

func (EncryptSalsa20) Encrypt added in v1.0.2013

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

加密

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)

解密

func (EncryptSeed) Encrypt added in v1.0.2013

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

加密

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)

解密

func (EncryptSerpent) Encrypt added in v1.0.2018

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

加密

type EncryptSkipjack added in v1.0.2018

type EncryptSkipjack struct{}

Skipjack key is 10 bytes.

func (EncryptSkipjack) Decrypt added in v1.0.2018

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

解密

func (EncryptSkipjack) Encrypt added in v1.0.2018

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

加密

type EncryptSquare added in v1.0.2038

type EncryptSquare struct{}

The key argument should be 32 bytes.

func (EncryptSquare) Decrypt added in v1.0.2038

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

解密

func (EncryptSquare) Encrypt added in v1.0.2038

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

加密

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)

解密

func (EncryptTea) Encrypt added in v1.0.2001

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

加密

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)

解密

func (EncryptTripleDes) Encrypt added in v1.0.2001

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

加密

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)

解密

func (EncryptTrivium) Encrypt added in v1.0.2039

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

加密

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)

解密

func (EncryptTwoDes) Encrypt added in v1.0.2010

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

加密

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)

解密

func (EncryptTwofish) Encrypt added in v1.0.2001

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

加密

type EncryptWake added in v1.0.2036

type EncryptWake struct{}

Wake key is 16 bytes.

func (EncryptWake) Decrypt added in v1.0.2036

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

解密

func (EncryptWake) Encrypt added in v1.0.2036

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

加密

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)

解密

func (EncryptXtea) Encrypt added in v1.0.2001

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

加密

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)

解密

func (EncryptXts) Encrypt added in v1.0.2001

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

加密

type ErrorFunc

type ErrorFunc = func([]error)

错误方法

type IEncrypt added in v1.0.2001

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

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

加密接口

type IMode added in v1.0.2001

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

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

模式接口

type IOption added in v1.0.2001

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

	// 向量
	Iv() []byte

	// 加密类型
	Multiple() Multiple

	// 加密模式
	Mode() Mode

	// 填充模式
	Padding() Padding

	// 额外配置
	Config() *tool.Config
}

配置接口

type IPadding added in v1.0.2001

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

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

填充接口

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 补码模式

func (ISO10126Paddinger) UnPadding added in v1.0.2006

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

UnPadding 补码模式

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 补码模式

func (ISO7816_4Paddinger) UnPadding added in v1.0.2006

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

UnPadding 补码模式

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 补码模式

func (ISO97971Paddinger) UnPadding added in v1.0.2006

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

UnPadding 补码模式

type Mode added in v1.0.1045

type Mode uint

加密模式

const (
	ECB Mode = 1 + iota
	CBC
	PCBC
	CFB
	CFB1
	CFB8
	CFB16
	CFB32
	CFB64
	CFB128
	OCFB
	OFB
	OFB8
	NCFB
	NOFB
	CTR
	GCM
	CCM
	OCB
	EAX
	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)

解密

func (ModeBC) Encrypt added in v1.0.2038

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

加密

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)

解密

func (ModeCBC) Encrypt added in v1.0.2001

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

加密

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)

解密

func (ModeCCM) Encrypt added in v1.0.2001

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

加密

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)

解密

func (ModeCFB) Encrypt added in v1.0.2001

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

加密

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)

解密

func (ModeCFB1) Encrypt added in v1.0.2006

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

加密

type ModeCFB16 added in v1.0.2006

type ModeCFB16 struct{}

func (ModeCFB16) Decrypt added in v1.0.2006

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

解密

func (ModeCFB16) Encrypt added in v1.0.2006

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

加密

type ModeCFB32 added in v1.0.2006

type ModeCFB32 struct{}

func (ModeCFB32) Decrypt added in v1.0.2006

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

解密

func (ModeCFB32) Encrypt added in v1.0.2006

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

加密

type ModeCFB64 added in v1.0.2006

type ModeCFB64 struct{}

func (ModeCFB64) Decrypt added in v1.0.2006

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

解密

func (ModeCFB64) Encrypt added in v1.0.2006

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

加密

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)

解密

func (ModeCFB8) Encrypt added in v1.0.2001

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

加密

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)

解密

func (ModeCTR) Encrypt added in v1.0.2001

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

加密

type ModeEAX added in v1.0.2024

type ModeEAX struct{}

func (ModeEAX) Decrypt added in v1.0.2024

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

解密

func (ModeEAX) Encrypt added in v1.0.2024

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

加密

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)

解密

func (ModeECB) Encrypt added in v1.0.2001

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

加密

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)

解密

func (ModeGCM) Encrypt added in v1.0.2001

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

加密

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)

解密

func (ModeHCTR) Encrypt added in v1.0.2038

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

加密

type ModeNCFB added in v1.0.2035

type ModeNCFB struct{}

func (ModeNCFB) Decrypt added in v1.0.2035

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

解密

func (ModeNCFB) Encrypt added in v1.0.2035

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

加密

type ModeNOFB added in v1.0.2035

type ModeNOFB struct{}

func (ModeNOFB) Decrypt added in v1.0.2035

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

解密

func (ModeNOFB) Encrypt added in v1.0.2035

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

加密

type ModeOCB added in v1.0.2024

type ModeOCB struct{}

func (ModeOCB) Decrypt added in v1.0.2024

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

解密

func (ModeOCB) Encrypt added in v1.0.2024

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

加密

type ModeOCFB added in v1.0.2025

type ModeOCFB struct{}

OCFB 模式不需要补码 默认 prefix 放置在结果数据之前

func (ModeOCFB) Decrypt added in v1.0.2025

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

解密

func (ModeOCFB) Encrypt added in v1.0.2025

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

加密

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)

解密

func (ModeOFB) Encrypt added in v1.0.2001

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

加密

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)

解密

func (ModeOFB8) Encrypt added in v1.0.2001

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

加密

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)

解密

func (ModePCBC) Encrypt added in v1.0.2007

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

加密

type Multiple added in v1.0.1045

type Multiple uint

加密类型

const (
	Aes Multiple = 1 + iota
	Des
	TwoDes
	TripleDes
	Twofish
	Blowfish
	Tea
	Xtea
	Cast5
	Cast256
	RC2
	RC4
	RC4MD5
	RC5
	RC6
	Idea
	SM4
	Chacha20
	Chacha20poly1305
	Chacha20poly1305X
	Xts
	Salsa20
	Seed
	Aria
	Camellia
	Gost
	Kuznyechik
	Skipjack
	Serpent
	Loki97
	Saferplus
	Mars
	Mars2
	Wake
	Enigma
	Hight
	Lea
	Panama
	Square
	Magenta
	Kasumi
	E2
	Crypton1
	Clefia
	Safer
	Noekeon
	Multi2
	Kseed
	Khazad
	Anubis
	Present
	Trivium
	Rijndael
	Rijndael128
	Rijndael192
	Rijndael256
)

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 补码模式

func (NoPaddinger) UnPadding added in v1.0.2006

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

UnPadding 补码模式

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 补码模式

func (PBOC2Paddinger) UnPadding added in v1.0.2027

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

UnPadding 补码模式

type PKCS1Paddinger added in v1.0.2001

type PKCS1Paddinger struct{}

func (PKCS1Paddinger) Padding added in v1.0.2001

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

Padding 补码模式

func (PKCS1Paddinger) UnPadding added in v1.0.2006

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

UnPadding 补码模式

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 补码模式

func (PKCS5Paddinger) UnPadding added in v1.0.2006

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

UnPadding 补码模式

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 补码模式

func (PKCS7Paddinger) UnPadding added in v1.0.2006

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

UnPadding 补码模式

type Padding added in v1.0.1045

type Padding uint

补码类型

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

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 补码模式

func (TBCPaddinger) UnPadding added in v1.0.2006

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

UnPadding 补码模式

type TypeName added in v1.0.2001

type TypeName interface {
	~uint | ~int
}

名称类型

type TypeSet added in v1.0.2001

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

类型数据

func NewTypeSet added in v1.0.2001

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

构造函数

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

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

生成新序列

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

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

设置

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 补码模式

func (X923Paddinger) UnPadding added in v1.0.2006

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

UnPadding 补码模式

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 补码模式

func (ZeroPaddinger) UnPadding added in v1.0.2006

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

UnPadding 补码模式

Jump to

Keyboard shortcuts

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