Documentation ¶
Index ¶
- Variables
- func AesECBGenerateKey(key []byte) (genKey []byte)
- func BlockDecrypt(block cipher.Block, data []byte, opt IOption) ([]byte, error)
- func BlockEncrypt(block cipher.Block, data []byte, opt IOption) ([]byte, error)
- type Config
- type Cryptobin
- func (this Cryptobin) Aes() Cryptobin
- func (this Cryptobin) AesCFB() Cryptobin
- func (this Cryptobin) AesECB() Cryptobin
- func (this Cryptobin) AppendError(err ...error) Cryptobin
- func (this Cryptobin) Aria() Cryptobin
- func (this Cryptobin) Blowfish(salt ...string) Cryptobin
- func (this Cryptobin) CBC() Cryptobin
- func (this Cryptobin) CCM(nonce string, additional ...string) Cryptobin
- func (this Cryptobin) CFB() Cryptobin
- func (this Cryptobin) CFB1() Cryptobin
- func (this Cryptobin) CFB128() Cryptobin
- func (this Cryptobin) CFB16() Cryptobin
- func (this Cryptobin) CFB32() Cryptobin
- func (this Cryptobin) CFB64() Cryptobin
- func (this Cryptobin) CFB8() Cryptobin
- func (this Cryptobin) CTR() Cryptobin
- func (this Cryptobin) Camellia() Cryptobin
- func (this Cryptobin) Cast5() Cryptobin
- func (this Cryptobin) Chacha20(nonce string, counter ...uint32) Cryptobin
- func (this Cryptobin) Chacha20poly1305(nonce string, additional string) Cryptobin
- func (this Cryptobin) Chacha20poly1305X(nonce string, additional string) Cryptobin
- func (this Cryptobin) Decrypt() Cryptobin
- func (this Cryptobin) Des() Cryptobin
- func (this Cryptobin) EAX(nonce string, additional ...string) Cryptobin
- func (this Cryptobin) ECB() Cryptobin
- func (this Cryptobin) Encrypt() Cryptobin
- func (this Cryptobin) Error() error
- func (this Cryptobin) FromBase64String(data string) Cryptobin
- func (this Cryptobin) FromBytes(data []byte) Cryptobin
- func (this Cryptobin) FromHexString(data string) Cryptobin
- func (this Cryptobin) FromString(data string) Cryptobin
- func (this Cryptobin) FuncDecrypt(f func(Cryptobin) Cryptobin) Cryptobin
- func (this Cryptobin) FuncEncrypt(f func(Cryptobin) Cryptobin) Cryptobin
- func (this Cryptobin) GCM(nonce string, additional ...string) Cryptobin
- func (this Cryptobin) GetConfig() *cryptobin_tool.Config
- func (this Cryptobin) GetData() []byte
- func (this Cryptobin) GetErrors() []error
- func (this Cryptobin) GetIv() []byte
- func (this Cryptobin) GetKey() []byte
- func (this Cryptobin) GetMode() Mode
- func (this Cryptobin) GetMultiple() Multiple
- func (this Cryptobin) GetOneConfig(key string) any
- func (this Cryptobin) GetPadding() Padding
- func (this Cryptobin) GetParsedData() []byte
- func (this Cryptobin) Gost(sbox any) Cryptobin
- func (this Cryptobin) ISO10126Padding() Cryptobin
- func (this Cryptobin) ISO7816_4Padding() Cryptobin
- func (this Cryptobin) ISO97971Padding() Cryptobin
- func (this Cryptobin) Idea() Cryptobin
- func (this Cryptobin) Kuznyechik() Cryptobin
- func (this Cryptobin) ModeBy(mode Mode, cfg ...map[string]any) Cryptobin
- func (this Cryptobin) MultipleBy(multiple Multiple, cfg ...map[string]any) Cryptobin
- func (this Cryptobin) NoPadding() Cryptobin
- func (this Cryptobin) NoParse() Cryptobin
- func (this Cryptobin) OCB(nonce string, additional ...string) Cryptobin
- func (this Cryptobin) OCFB(resync bool) Cryptobin
- func (this Cryptobin) OFB() Cryptobin
- func (this Cryptobin) OFB8() Cryptobin
- func (this Cryptobin) OnError(fn ErrorFunc) Cryptobin
- func (this Cryptobin) PBOC2Padding() Cryptobin
- func (this Cryptobin) PCBC() Cryptobin
- func (this Cryptobin) PKCS1Padding(bt ...string) Cryptobin
- func (this Cryptobin) PKCS5Padding() Cryptobin
- func (this Cryptobin) PKCS7Padding() Cryptobin
- func (this Cryptobin) PaddingBy(padding Padding, cfg ...map[string]any) Cryptobin
- func (this Cryptobin) PutConfig(key string, value any) Cryptobin
- func (this Cryptobin) RC2() Cryptobin
- func (this Cryptobin) RC4() Cryptobin
- func (this Cryptobin) RC4MD5() Cryptobin
- func (this Cryptobin) RC5(wordSize, rounds uint) Cryptobin
- func (this Cryptobin) SM4() Cryptobin
- func (this Cryptobin) Salsa20(nonce string) Cryptobin
- func (this Cryptobin) Seed() Cryptobin
- func (this Cryptobin) Serpent() Cryptobin
- func (this Cryptobin) SetConfig(data map[string]any) Cryptobin
- func (this Cryptobin) SetData(data string) Cryptobin
- func (this Cryptobin) SetIv(data string) Cryptobin
- func (this Cryptobin) SetKey(data string) Cryptobin
- func (this Cryptobin) SetMode(mode Mode, cfg map[string]any) Cryptobin
- func (this Cryptobin) SetMultiple(multiple Multiple, cfg map[string]any) Cryptobin
- func (this Cryptobin) SetPadding(padding Padding, cfg map[string]any) Cryptobin
- func (this Cryptobin) SetParsedData(data string) Cryptobin
- func (this Cryptobin) Skipjack() Cryptobin
- func (this Cryptobin) String() string
- func (this Cryptobin) TBCPadding() Cryptobin
- func (this Cryptobin) Tea(rounds ...int) Cryptobin
- func (this Cryptobin) ToBase64String() string
- func (this Cryptobin) ToBytes() []byte
- func (this Cryptobin) ToHexString() string
- func (this Cryptobin) ToString() string
- func (this Cryptobin) TripleDes() Cryptobin
- func (this Cryptobin) TwoDes() Cryptobin
- func (this Cryptobin) Twofish() Cryptobin
- func (this Cryptobin) WithConfig(config *cryptobin_tool.Config) Cryptobin
- func (this Cryptobin) WithData(data []byte) Cryptobin
- func (this Cryptobin) WithErrors(errs []error) Cryptobin
- func (this Cryptobin) WithIv(iv []byte) Cryptobin
- func (this Cryptobin) WithKey(key []byte) Cryptobin
- func (this Cryptobin) WithMode(mode Mode) Cryptobin
- func (this Cryptobin) WithMultiple(multiple Multiple) Cryptobin
- func (this Cryptobin) WithPadding(padding Padding) Cryptobin
- func (this Cryptobin) WithParsedData(data []byte) Cryptobin
- func (this Cryptobin) X923Padding() Cryptobin
- func (this Cryptobin) Xtea() Cryptobin
- func (this Cryptobin) Xts(cipher string, sectorNum uint64) Cryptobin
- func (this Cryptobin) ZeroPadding() Cryptobin
- type DataName
- type DataSet
- func (this *DataSet[N, M]) Add(name N, data func() M) *DataSet[N, M]
- func (this *DataSet[N, M]) All() map[N]func() M
- func (this *DataSet[N, M]) Clean()
- func (this *DataSet[N, M]) Get(name N) func() M
- func (this *DataSet[N, M]) Has(name N) bool
- func (this *DataSet[N, M]) Len() int
- func (this *DataSet[N, M]) Names() []N
- func (this *DataSet[N, M]) Remove(name N) *DataSet[N, M]
- type EncryptAes
- type EncryptAesCFB
- type EncryptAesECB
- type EncryptAria
- type EncryptBlowfish
- type EncryptCamellia
- type EncryptCast5
- type EncryptChacha20
- type EncryptChacha20poly1305
- type EncryptChacha20poly1305X
- type EncryptDes
- type EncryptGost
- type EncryptIdea
- type EncryptKuznyechik
- type EncryptRC2
- type EncryptRC4
- type EncryptRC4MD5
- type EncryptRC5
- type EncryptSM4
- type EncryptSalsa20
- type EncryptSeed
- type EncryptSerpent
- type EncryptSkipjack
- type EncryptTea
- type EncryptTripleDes
- type EncryptTwoDes
- type EncryptTwofish
- type EncryptXtea
- type EncryptXts
- type ErrorFunc
- type IEncrypt
- type IMode
- type IOption
- type IPadding
- type ISO10126Paddinger
- type ISO7816_4Paddinger
- type ISO97971Paddinger
- type Mode
- type ModeCBC
- type ModeCCM
- type ModeCFB
- type ModeCFB1
- type ModeCFB16
- type ModeCFB32
- type ModeCFB64
- type ModeCFB8
- type ModeCTR
- type ModeEAX
- type ModeECB
- type ModeGCM
- type ModeOCB
- type ModeOCFB
- type ModeOFB
- type ModeOFB8
- type ModePCBC
- type Multiple
- type NoPaddinger
- type PBOC2Paddinger
- type PKCS1Paddinger
- type PKCS5Paddinger
- type PKCS7Paddinger
- type Padding
- type TBCPaddinger
- type TypeName
- type TypeSet
- type X923Paddinger
- type ZeroPaddinger
Constants ¶
This section is empty.
Variables ¶
var ( AesCFB = TypeMultiple.Generate() AesECB = TypeMultiple.Generate() )
var TypeMode = NewTypeSet[Mode, string](maxMode)
模式
var TypeMultiple = NewTypeSet[Multiple, string](maxMultiple)
类型
var TypePadding = NewTypeSet[Padding, string](maxPadding)
补码
var UseEncrypt = NewDataSet[Multiple, IEncrypt]()
加密解密
var UseMode = NewDataSet[Mode, IMode]()
模式
var UsePadding = NewDataSet[Padding, IPadding]()
补码
Functions ¶
func AesECBGenerateKey ¶ added in v1.0.2025
AesECB key 处理
func BlockDecrypt ¶ added in v1.0.2001
解密
Types ¶
type Config ¶ added in v1.0.2001
type Config struct {
// contains filtered or unexported fields
}
*
- 包装配置 *
- @create 2023-3-30
- @author deatil
type Cryptobin ¶
type Cryptobin struct { // 错误 Errors []error // contains filtered or unexported fields }
*
- 对称加密 *
- @create 2022-3-19
- @author deatil
func (Cryptobin) AppendError ¶ added in v1.0.1026
添加错误
func (Cryptobin) Camellia ¶ added in v1.0.2013
Camellia The key argument should be 16, 24, or 32 bytes.
func (Cryptobin) Chacha20poly1305 ¶
Chacha20poly1305 nonce is 12 bytes
func (Cryptobin) Chacha20poly1305X ¶ added in v1.0.1031
Chacha20poly1305X nonce is 24 bytes
func (Cryptobin) FromBase64String ¶
Base64
func (Cryptobin) FuncDecrypt ¶
方法解密
func (Cryptobin) FuncEncrypt ¶
方法加密
func (Cryptobin) Gost ¶ added in v1.0.2018
Gost The key argument should be 32 bytes. sbox is [DESDerivedSbox | TestSbox | CryptoProSbox | SboxIdtc26gost28147paramZ] or set [][]byte data
func (Cryptobin) ISO97971Padding ¶ added in v1.0.1026
ISO97971 补码
func (Cryptobin) Kuznyechik ¶ added in v1.0.2018
Kuznyechik The key argument should be 32 bytes.
func (Cryptobin) MultipleBy ¶ added in v1.0.2001
使用类型
func (Cryptobin) OCB ¶ added in v1.0.2024
OCB OCB nounce size, should be in [0, cipher.block.BlockSize]
func (Cryptobin) PBOC2Padding ¶ added in v1.0.2027
PBOC2 补码
func (Cryptobin) SetMultiple ¶ added in v1.0.2001
设置加密类型带参数
func (Cryptobin) SetPadding ¶ added in v1.0.2001
设置补码算法带参数
func (Cryptobin) SetParsedData ¶ added in v1.0.2001
设置解析后的数据
func (Cryptobin) WithConfig ¶
func (this Cryptobin) WithConfig(config *cryptobin_tool.Config) Cryptobin
设置配置
func (Cryptobin) WithErrors ¶ added in v1.0.1026
设置错误
func (Cryptobin) WithMultiple ¶
加密类型
func (Cryptobin) WithParsedData ¶
设置解析后的数据
type DataSet ¶ added in v1.0.2001
*
- 数据设置 *
- @create 2023-3-31
- @author deatil
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.
type EncryptAesCFB ¶ added in v1.0.2001
type EncryptAesCFB struct{}
type EncryptAesECB ¶ added in v1.0.2001
type EncryptAesECB struct{}
type EncryptAria ¶ added in v1.0.2013
type EncryptAria struct{}
Aria key is 16, 24, or 32 bytes.
type EncryptBlowfish ¶ added in v1.0.2001
type EncryptBlowfish struct{}
type EncryptCamellia ¶ added in v1.0.2013
type EncryptCamellia struct{}
Camellia key is 16, 24, or 32 bytes.
type EncryptCast5 ¶ added in v1.0.2001
type EncryptCast5 struct{}
type EncryptChacha20 ¶ added in v1.0.2001
type EncryptChacha20 struct{}
32 bytes key and a 12 or 24 bytes nonce
type EncryptChacha20poly1305 ¶ added in v1.0.2001
type EncryptChacha20poly1305 struct{}
32 bytes key
type EncryptChacha20poly1305X ¶ added in v1.0.2001
type EncryptChacha20poly1305X struct{}
32 bytes key
type EncryptDes ¶ added in v1.0.2001
type EncryptDes struct{}
type EncryptGost ¶ added in v1.0.2018
type EncryptGost struct{}
Gost key is 32 bytes.
type EncryptIdea ¶ added in v1.0.2013
type EncryptIdea struct{}
type EncryptKuznyechik ¶ added in v1.0.2018
type EncryptKuznyechik struct{}
Kuznyechik key is 32 bytes.
type EncryptRC2 ¶ added in v1.0.2001
type EncryptRC2 struct{}
type EncryptRC4 ¶ added in v1.0.2001
type EncryptRC4 struct{}
RC4 key, at least 1 byte and at most 256 bytes.
type EncryptRC4MD5 ¶ added in v1.0.2013
type EncryptRC4MD5 struct{}
RC4 key, at least 1 byte and at most 256 bytes.
type EncryptRC5 ¶ added in v1.0.2001
type EncryptRC5 struct{}
type EncryptSM4 ¶ added in v1.0.2001
type EncryptSM4 struct{}
type EncryptSalsa20 ¶ added in v1.0.2013
type EncryptSalsa20 struct{}
Salsa20 key is 32 bytes. nonce is 16 bytes.
type EncryptSeed ¶ added in v1.0.2013
type EncryptSeed struct{}
Seed key is 16 bytes.
type EncryptSerpent ¶ added in v1.0.2018
type EncryptSerpent struct{}
Serpent key is 16, 24, 32 bytes.
type EncryptSkipjack ¶ added in v1.0.2018
type EncryptSkipjack struct{}
Skipjack key is 10 bytes.
type EncryptTea ¶ added in v1.0.2001
type EncryptTea struct{}
type EncryptTripleDes ¶ added in v1.0.2001
type EncryptTripleDes struct{}
type EncryptTwoDes ¶ added in v1.0.2010
type EncryptTwoDes struct{}
type EncryptTwofish ¶ added in v1.0.2001
type EncryptTwofish struct{}
The key argument should be the Twofish key, 16, 24 or 32 bytes.
type EncryptXtea ¶ added in v1.0.2001
type EncryptXtea struct{}
type EncryptXts ¶ added in v1.0.2001
type EncryptXts struct{}
Sectors must be a multiple of 16 bytes and less than 2²⁴ bytes.
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{}
type ISO7816_4Paddinger ¶ added in v1.0.2001
type ISO7816_4Paddinger struct{}
type ISO97971Paddinger ¶ added in v1.0.2001
type ISO97971Paddinger struct{}
type ModeCBC ¶ added in v1.0.2001
type ModeCBC struct{}
type ModeCCM ¶ added in v1.0.2001
type ModeCCM struct{}
type ModeCFB ¶ added in v1.0.2001
type ModeCFB struct{}
type ModeCFB1 ¶ added in v1.0.2006
type ModeCFB1 struct{}
type ModeCFB16 ¶ added in v1.0.2006
type ModeCFB16 struct{}
type ModeCFB32 ¶ added in v1.0.2006
type ModeCFB32 struct{}
type ModeCFB64 ¶ added in v1.0.2006
type ModeCFB64 struct{}
type ModeCFB8 ¶ added in v1.0.2001
type ModeCFB8 struct{}
type ModeCTR ¶ added in v1.0.2001
type ModeCTR struct{}
type ModeEAX ¶ added in v1.0.2024
type ModeEAX struct{}
type ModeECB ¶ added in v1.0.2001
type ModeECB struct{}
type ModeGCM ¶ added in v1.0.2001
type ModeGCM struct{}
type ModeOCB ¶ added in v1.0.2024
type ModeOCB struct{}
type ModeOCFB ¶ added in v1.0.2025
type ModeOCFB struct{}
OCFB 模式不需要补码 默认 prefix 放置在结果数据之前
type ModeOFB ¶ added in v1.0.2001
type ModeOFB struct{}
type ModeOFB8 ¶ added in v1.0.2001
type ModeOFB8 struct{}
type ModePCBC ¶ added in v1.0.2007
type ModePCBC struct{}
type NoPaddinger ¶ added in v1.0.2001
type NoPaddinger struct{}
type PBOC2Paddinger ¶ added in v1.0.2027
type PBOC2Paddinger struct{}
type PKCS1Paddinger ¶ added in v1.0.2001
type PKCS1Paddinger struct{}
type PKCS5Paddinger ¶ added in v1.0.2001
type PKCS5Paddinger struct{}
type PKCS7Paddinger ¶ added in v1.0.2001
type PKCS7Paddinger struct{}
type TBCPaddinger ¶ added in v1.0.2001
type TBCPaddinger struct{}
type X923Paddinger ¶ added in v1.0.2001
type X923Paddinger struct{}
type ZeroPaddinger ¶ added in v1.0.2001
type ZeroPaddinger struct{}