crypto

package
v1.0.1022 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2022 License: Apache-2.0 Imports: 21 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cryptobin

type Cryptobin struct {

	// 错误
	Error 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) AesCFBDecrypt

func (this Cryptobin) AesCFBDecrypt() Cryptobin

解密

func (Cryptobin) AesCFBEncrypt

func (this Cryptobin) AesCFBEncrypt() Cryptobin

加密

func (Cryptobin) AesECBDecrypt

func (this Cryptobin) AesECBDecrypt() Cryptobin

func (Cryptobin) AesECBEncrypt

func (this Cryptobin) AesECBEncrypt() Cryptobin

func (Cryptobin) AesECBGenerateKey

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

func (Cryptobin) Blowfish

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

Blowfish

func (Cryptobin) CBC

func (this Cryptobin) CBC() Cryptobin

密码分组链接模式

func (Cryptobin) CFB

func (this Cryptobin) CFB() 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) Cast5

func (this Cryptobin) Cast5() Cryptobin

Cast5

func (Cryptobin) Chacha20

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

Chacha20

func (Cryptobin) Chacha20poly1305

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

Chacha20poly1305 nonce is 12 bytes

func (Cryptobin) CheckGuessMultiple

func (this Cryptobin) CheckGuessMultiple() bool

检测 guess 方式

func (Cryptobin) CipherBlock

func (this Cryptobin) CipherBlock(key []byte) (cipher.Block, error)

Cipher

func (Cryptobin) CipherDecrypt

func (this Cryptobin) CipherDecrypt() Cryptobin

解密

func (Cryptobin) CipherEncrypt

func (this Cryptobin) CipherEncrypt() Cryptobin

加密

func (Cryptobin) Decrypt

func (this Cryptobin) Decrypt() Cryptobin

解密

func (Cryptobin) Des

func (this Cryptobin) Des() Cryptobin

Des

func (Cryptobin) ECB

func (this Cryptobin) ECB() Cryptobin

电码本模式

func (Cryptobin) Encrypt

func (this Cryptobin) Encrypt() Cryptobin

加密

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() map[string]any

获取全部配置

func (Cryptobin) GetData

func (this Cryptobin) GetData() []byte

数据

func (Cryptobin) GetError

func (this Cryptobin) GetError() error

错误信息

func (Cryptobin) GetIv

func (this Cryptobin) GetIv() []byte

向量

func (Cryptobin) GetKey

func (this Cryptobin) GetKey() []byte

密码

func (Cryptobin) GetMode

func (this Cryptobin) GetMode() string

加密方式

func (Cryptobin) GetMultiple

func (this Cryptobin) GetMultiple() string

加密类型

func (Cryptobin) GetOneConfig

func (this Cryptobin) GetOneConfig(key string) any

获取一个配置

func (Cryptobin) GetPadding

func (this Cryptobin) GetPadding() string

补码算法

func (Cryptobin) GetParsedData

func (this Cryptobin) GetParsedData() []byte

解析后的数据

func (Cryptobin) GuessDecrypt

func (this Cryptobin) GuessDecrypt() Cryptobin

解密

func (Cryptobin) GuessEncrypt

func (this Cryptobin) GuessEncrypt() Cryptobin

加密

func (Cryptobin) ISO10126Padding

func (this Cryptobin) ISO10126Padding() Cryptobin

ISO10126 补码

func (Cryptobin) ISO7816_4Padding

func (this Cryptobin) ISO7816_4Padding() Cryptobin

ISO7816_4 补码

func (Cryptobin) NoPadding

func (this Cryptobin) NoPadding() Cryptobin

不补码

func (Cryptobin) NoParse

func (this Cryptobin) NoParse() Cryptobin

不做处理

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) 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) Padding

func (this Cryptobin) Padding(plainText []byte, blockSize int) []byte

Padding 补码模式

func (Cryptobin) RC4

func (this Cryptobin) RC4() Cryptobin

RC4

func (Cryptobin) RsaDecrypt

func (this Cryptobin) RsaDecrypt(password ...string) Cryptobin

RSA 私钥解密 pkcs8 带密码不支持其他工具生成的密钥

func (Cryptobin) RsaEncrypt

func (this Cryptobin) RsaEncrypt() Cryptobin

RSA 公钥加密

func (Cryptobin) RsaOAEPDecrypt

func (this Cryptobin) RsaOAEPDecrypt(typ string, password ...string) Cryptobin

RSA OAEP 私钥解密 pkcs8 带密码不支持其他工具生成的密钥 typ 为 hash.defaultHashes 对应数据

func (Cryptobin) RsaOAEPEncrypt

func (this Cryptobin) RsaOAEPEncrypt(typ string) Cryptobin

RSA OAEP 公钥加密 typ 为 hash.defaultHashes 对应数据

func (Cryptobin) RsaPrikeyEncrypt

func (this Cryptobin) RsaPrikeyEncrypt(password ...string) Cryptobin

RSA 私钥加密 pkcs8 带密码不支持其他工具生成的密钥

func (Cryptobin) RsaPubkeyDecrypt

func (this Cryptobin) RsaPubkeyDecrypt() Cryptobin

RSA 公钥解密

func (Cryptobin) SM2Decrypt

func (this Cryptobin) SM2Decrypt(password ...string) Cryptobin

SM2 私钥解密

func (Cryptobin) SM2Encrypt

func (this Cryptobin) SM2Encrypt() Cryptobin

SM2 公钥加密

func (Cryptobin) SM4

func (this Cryptobin) SM4() Cryptobin

SM4

func (Cryptobin) SetIv

func (this Cryptobin) SetIv(data string) Cryptobin

向量

func (Cryptobin) SetKey

func (this Cryptobin) SetKey(data string) Cryptobin

密码

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) TriDes

func (this Cryptobin) TriDes() Cryptobin

TriDes

func (Cryptobin) Twofish

func (this Cryptobin) Twofish() Cryptobin

Twofish

func (Cryptobin) UnPadding

func (this Cryptobin) UnPadding(cipherText []byte) []byte

UnPadding 补码模式

func (Cryptobin) WithConfig

func (this Cryptobin) WithConfig(config map[string]any) Cryptobin

配置

func (Cryptobin) WithData

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

设置数据

func (Cryptobin) WithError

func (this Cryptobin) WithError(err 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 string) Cryptobin

加密方式

func (Cryptobin) WithMultiple

func (this Cryptobin) WithMultiple(multiple string) Cryptobin

加密类型

func (Cryptobin) WithOneConfig

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

设置一个配置

func (Cryptobin) WithPadding

func (this Cryptobin) WithPadding(padding string) 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 | TriDes | Tea | Xtea | Twofish | Blowfish | Cast5 | SM4]

func (Cryptobin) ZeroPadding

func (this Cryptobin) ZeroPadding() Cryptobin

Zero 补码

type ErrorFunc

type ErrorFunc = func(error)

错误方法

Jump to

Keyboard shortcuts

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