Versions in this module Expand all Collapse all v0 v0.0.1 Nov 20, 2023 Changes in this version + const BlockSize_AES128 + const BlockSize_AES192 + const BlockSize_AES256 + func CipherModeNames() []string + func EncryptionMethodNames() []string + func LoadConfig(cfg Config) error + func PKCS7Padding(src []byte, blockSize int) []byte + func PKCS7Unpadding(src []byte) []byte + func PaddingNames() []string + func PrintConfig(w io.Writer, cfg Config) + func RandBytes(n int) (b []byte, err error) + func SaltDecodeRule(src []byte, salt []byte, has bool) (src_, salt_ []byte) + func SaltEncodeRule(src []byte, salt []byte, has bool) (src_ []byte) + func StrConvNames() []string + type BlockSize_AES int + type BlockSize_DES int + const BlockSize_DES64 + type Cipher interface + Decode func(src []byte) ([]byte, error) + DecodeDetail func(src []byte, callback ...func(map[string]interface{})) ([]byte, error) + Encode func(src []byte) ([]byte, error) + EncodeDetail func(src []byte, callback ...func(map[string]interface{})) ([]byte, error) + func CipherSet(k string) Cipher + type CipherMode int + const CipherModeCBC + const CipherModeGCM + const CipherModeNONE + func ParseCipherMode(name string) (CipherMode, error) + func (mode CipherMode) CipherFactory(block cipher.Block, salt *Salt) (encoder Encoder, decoder Decoder, err error) + func (x CipherMode) String() string + type Config struct + CryptoAlgorithmSet map[string]ConfigCryptoAlgorithm + type ConfigBlock struct + BlockKey string + BlockSize int + EncryptionMethod string + type ConfigCipher struct + CipherMode string + CipherSalt *string + type ConfigCryptoAlgorithm struct + func (cfg ConfigCryptoAlgorithm) ToOption() MachineOption + type ConfigPadding struct + Padding string + type ConfigStrConv struct + StrConv string + type Decoder func(src, salt []byte) (dst []byte, err error) + type Encoder func(src, salt []byte) (dst []byte, err error) + type EncryptionMethod int + const EncryptionMethodAES + const EncryptionMethodDES + const EncryptionMethodNONE + func ParseEncryptionMethod(name string) (EncryptionMethod, error) + func (method EncryptionMethod) BlockFactory() (fn func(key []byte) (cipher.Block, error), err error) + func (x EncryptionMethod) String() string + type Machine struct + func NewMachine(opt MachineOption) (m *Machine, err error) + func (machine *Machine) Decode(src []byte) ([]byte, error) + func (machine *Machine) DecodeDetail(src []byte, callback ...func(map[string]interface{})) (dst []byte, err error) + func (machine *Machine) Encode(src []byte) ([]byte, error) + func (machine *Machine) EncodeDetail(src []byte, callback ...func(map[string]interface{})) (dst []byte, err error) + type MachineOption struct + Block struct{ ... } + Cipher struct{ ... } + Padding string + StrConv string + type NoneEncripter struct + func (encripter NoneEncripter) BlockSize() int + func (encripter NoneEncripter) Decrypt(dst, src []byte) + func (encripter NoneEncripter) Encrypt(dst, src []byte) + type Padding int + const PaddingNONE + const PaddingPKCS + func ParsePadding(name string) (Padding, error) + func (padding Padding) Padder() func([]byte, int) []byte + func (padding Padding) Unpadder() func(src []byte) (dst []byte) + func (x Padding) String() string + type Salt struct + func (salt *Salt) SetLen(n int) *Salt + func (salt *Salt) SetValue(b []byte) *Salt + func (salt Salt) GenSalt() []byte + func (salt Salt) Has() bool + func (salt Salt) Len() int + func (salt Salt) Scope(fn func(*ScopeSalt) error) error + type ScopeSalt struct + func (salt *ScopeSalt) GenSalt() []byte + type StrConv int + const StrConvBase64 + const StrConvHex + const StrConvPlain + func ParseStrConv(name string) (StrConv, error) + func (conv StrConv) Decoder() func([]byte) ([]byte, error) + func (conv StrConv) Encoder() func([]byte) []byte + func (x StrConv) String() string