Documentation ¶
Index ¶
- func AesDecrypt(cipherData []byte, opts ...AesOption) ([]byte, error)
- func AesDecryptHex(cipherStr string, opts ...AesOption) (string, error)
- func AesEncrypt(rawData []byte, opts ...AesOption) ([]byte, error)
- func AesEncryptHex(rawData string, opts ...AesOption) (string, error)
- func DesDecrypt(cipherData []byte, opts ...DesOption) ([]byte, error)
- func DesDecryptHex(cipherStr string, opts ...DesOption) (string, error)
- func DesEncrypt(rawData []byte, opts ...DesOption) ([]byte, error)
- func DesEncryptHex(rawData string, opts ...DesOption) (string, error)
- func Hash(hashType crypto.Hash, rawData []byte) (string, error)
- func HashAndSaltPassword(password string) (string, error)
- func Md5(rawData []byte) string
- func RsaDecrypt(privateKey []byte, cipherData []byte, opts ...RsaOption) ([]byte, error)
- func RsaDecryptHex(privateKey []byte, cipherHex string, opts ...RsaOption) (string, error)
- func RsaEncrypt(publicKey []byte, rawData []byte, opts ...RsaOption) ([]byte, error)
- func RsaEncryptHex(publicKey []byte, rawData []byte, opts ...RsaOption) (string, error)
- func RsaSign(privateKey []byte, rawData []byte, opts ...RsaOption) ([]byte, error)
- func RsaSignBase64(privateKey []byte, rawData []byte, opts ...RsaOption) (string, error)
- func RsaVerify(publicKey []byte, rawData []byte, signData []byte, opts ...RsaOption) error
- func RsaVerifyBase64(publicKey []byte, rawData []byte, signBase64 string, opts ...RsaOption) error
- func Sha1(rawData []byte) string
- func Sha256(rawData []byte) string
- func Sha512(rawData []byte) string
- func VerifyPassword(password string, hashed string) bool
- type AesOption
- type DesOption
- type RsaOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AesDecrypt ¶
AesDecrypt aes解密byte,参数输入未经过转码的密文
func AesDecryptHex ¶
AesDecryptHex aes解密string,参数输入已经转码的密文字符串
func AesEncrypt ¶
AesEncrypt aes加密byte,返回的密文未经过转码
func AesEncryptHex ¶
AesEncryptHex aes加密string,返回的密文已经转码
func DesDecrypt ¶
DesDecrypt des解密byte,参数输入未经过转码的密文
func DesDecryptHex ¶
DesDecryptHex des解密string,参数输入已经转码的密文字符串
func DesEncrypt ¶
DesEncrypt des加密byte,返回的密文未经过转码
func DesEncryptHex ¶
DesEncryptHex des加密string,返回的密文已经转码
func HashAndSaltPassword ¶
HashAndSaltPassword 对密码加盐哈希
func RsaDecrypt ¶
RsaDecrypt rsa解密byte,参数输入未经过转码的密文
func RsaDecryptHex ¶
RsaDecryptHex rsa解密,返回原文
func RsaEncrypt ¶
RsaEncrypt rsa加密byte,返回的密文未经过转码
func RsaEncryptHex ¶
RsaEncryptHex rsa加密,返回hex
func RsaSignBase64 ¶
RsaSignBase64 rsa签名,返回base64
func RsaVerifyBase64 ¶
RsaVerifyBase64 rsa验签
func VerifyPassword ¶
VerifyPassword 验证密码和密文是否匹配
Types ¶
type RsaOption ¶
type RsaOption func(*rsaOptions)
RsaOption set the rsa options.
func WithRsaHashType ¶
WithRsaHashType set hash type
func WithRsaHashTypeSha256 ¶
func WithRsaHashTypeSha256() RsaOption
WithRsaHashTypeSha256 set hash type
func WithRsaHashTypeSha512 ¶
func WithRsaHashTypeSha512() RsaOption
WithRsaHashTypeSha512 set hash type
Click to show internal directories.
Click to hide internal directories.