Versions in this module Expand all Collapse all v1 v1.0.0 Nov 6, 2022 Changes in this version + const AES + const DES + const DES3 + var ErrAesKeySize = errors.New("key size must be 16, 24, or 32 bytes") + var ErrAesNotSupportedGcm = errors.New("aes-gcm not supported") + var ErrDes3NotSupportedGcm = errors.New("des3-gcm not supported") + var ErrDesKeySize = errors.New("key size must be 8") + var ErrDesNotSupportedGcm = errors.New("des-gcm not supported") + func HmacSha256(data []byte, key string) string + func HmacSha256String(data string, key string) string + func MD5(data []byte) *encodex.Encode + func NotAesValidKeySize(k KeySize) bool + func PadZeroKey(key []byte, size int) []byte + func RSADecrypt(src, priKey []byte) ([]byte, error) + func RSAEncrypt(src, pubKey []byte) ([]byte, error) + func RSAGenerateKey(bits int, out io.Writer) error + func RSAGeneratePublicKey(priKey []byte, out io.Writer) error + func RSASign(src []byte, priKey []byte, hash ...crypto.Hash) ([]byte, error) + func RSAVerify(src, sign, pubKey []byte, hash ...crypto.Hash) error + func SHA1(data []byte) *encodex.Encode + func SHA224(data []byte) *encodex.Encode + func SHA256(data []byte) *encodex.Encode + func SHA384(data []byte) *encodex.Encode + func SHA512(data []byte) *encodex.Encode + type Crypto interface + Decrypt func(ciphertext []byte) (plaintext []byte, err error) + Encrypt func(plaintext []byte) (*encodex.Encode, error) + func NewAES(fns ...OptionFn) (Crypto, error) + func NewDES(fns ...OptionFn) (Crypto, error) + func NewDES3(fns ...OptionFn) (Crypto, error) + func NewRC4(key []byte) (Crypto, error) + type KeySize int + const KeySize128 + const KeySize192 + const KeySize256 + const KeySize64 + func (k KeySize) Int() int + func (k KeySize) Not(size KeySize) bool + type Method string + func (m Method) Is(m1 Method) bool + func (m Method) String() string + type OptionFn func(*options) + func WithIV(iv []byte) OptionFn + func WithKey(key []byte) OptionFn + func WithKeySize(keySize KeySize) OptionFn + func WithMethod(method Method) OptionFn + func WithMode(m mode.Mode) OptionFn + func WithPadding(p padding.Mode) OptionFn + type RC4 struct + func (r *RC4) Decrypt(ciphertext []byte) (plaintext []byte, err error) + func (r *RC4) Encrypt(plaintext []byte) (*encodex.Encode, error)