Versions in this module Expand all Collapse all v1 v1.4.0 Feb 24, 2024 Changes in this version + func CreateMd5Password(password string) string + func CreatePassword(password string) string + func CreateToken(prefix []byte, tailsize int) string + func GetPasswordChanges(password string) map[string]any + func Md5(data string) string + func Md5File(filename string) (string, error) + func Md5Sum(data string) string + func NewSerialNo(n byte) string + func NewTimeSerialNo(n byte, t time.Time) string + func PKCS5Padding(cipherText []byte, blockSize int) []byte + func PKCS5Unpadding(origData []byte) []byte + func PKCS7Padding(cipherText []byte, blockSize int) []byte + func PKCS7Unpadding(origData []byte) []byte + func RandSalt(size int) string + func VerifyPassword(plainText, cipherText string) bool + func ZeroPadding(cipherText []byte, blockSize int) []byte + func ZeroUnpadding(origData []byte) []byte + type AESCipher struct + Padding PaddingFunc + Unpadding UnpaddingFunc + func NewAESCipher(mode string, key []byte) (*AESCipher, error) + func (c *AESCipher) Decrypt(cipherText []byte) ([]byte, error) + func (c *AESCipher) Encrypt(origData []byte) ([]byte, error) + func (c *AESCipher) GetDecrypter() cipher.BlockMode + func (c *AESCipher) GetEncrypter() cipher.BlockMode + func (c *AESCipher) GetStream(isDecrypt bool) cipher.Stream + func (c *AESCipher) SetPaddingFunc(name string) + type ICipher interface + CreatePassword func(plainText string) string + VerifyPassword func(plainText, cipherText string) bool + func Cipher() ICipher + type MacHash struct + func NewMacHash(creator NewHashFunc) *MacHash + func (h *MacHash) SetKey(key string) *MacHash + func (h MacHash) MacSum(text string) []byte + func (h MacHash) Sign(text string) string + func (h MacHash) Verify(text, hashed string) bool + type NewHashFunc func() hash.Hash + type PaddingFunc func(cipherText []byte, blockSize int) []byte + type RSACipher struct + func NewRSACipher(privKey, pubKey string) RSACipher + func (c RSACipher) Decrypt(cipherText []byte) ([]byte, error) + func (c RSACipher) Encrypt(origData []byte) ([]byte, error) + func (c RSACipher) GetBlock(key []byte, errmsg string) (*pem.Block, error) + func (c RSACipher) GetPrivateKey() (*rsa.PrivateKey, error) + func (c RSACipher) GetPublicKey() (*rsa.PublicKey, error) + func (c RSACipher) Sign(hash crypto.Hash, msg []byte) ([]byte, error) + func (c RSACipher) Verify(hash crypto.Hash, msg, sig []byte) error + type SaltPassword struct + func NewSaltPassword(len int, sep string) *SaltPassword + func (p *SaltPassword) CreatePassword(plainText string) string + func (p *SaltPassword) VerifyPassword(plainText, cipherText string) bool + type UnpaddingFunc func(origData []byte) []byte