Documentation
¶
Index ¶
- func GenRSAKey(out io.Writer, bits int) error
- func HashCode(s string) uint32
- func Md5(s string) string
- func NewNonce(size int) []byte
- func Sha256(dst string) string
- func Sha256WithSalt(dst string, salt string) string
- type AESCrypt
- func (c *AESCrypt) Decode2Byte(s string) ([]byte, error)
- func (c *AESCrypt) Decrypt(ciphertext string) (string, error)
- func (c *AESCrypt) Decrypt2Byte(ciphertext string) ([]byte, error)
- func (c *AESCrypt) Encode2Str(b []byte) string
- func (c *AESCrypt) Encrypt(plaintext string) (string, error)
- func (c *AESCrypt) Encrypt4Byte(plaintext []byte) (string, error)
- func (c *AESCrypt) NewNonce() []byte
- func (c *AESCrypt) NewNonceStr() string
- type OptFunc
- type RsaCrypt
- func (r *RsaCrypt) Decrypt(ciphertext []byte) ([]byte, error)
- func (r *RsaCrypt) DecryptPKCS1v15(ciphertext []byte) ([]byte, error)
- func (r *RsaCrypt) DecryptToString(ciphertext string) (string, error)
- func (r *RsaCrypt) DecryptToStringByHex(ciphertext string) (string, error)
- func (r *RsaCrypt) Encrypt(msg []byte) ([]byte, error)
- func (r *RsaCrypt) EncryptPKCS1v15(msg []byte) ([]byte, error)
- func (r *RsaCrypt) EncryptToString(plaintext string) (string, error)
- func (r *RsaCrypt) EncryptToStringByHex(plaintext string) (string, error)
- func (r *RsaCrypt) SetPrivateKey(private []byte) error
- func (r *RsaCrypt) SetPrivateKeyByBase64Str(privateStr string) error
- func (r *RsaCrypt) SetPublicKey(public []byte) error
- func (r *RsaCrypt) SetPublicKeyByBase64Str(publicStr string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Sha256WithSalt ¶
Types ¶
type AESCrypt ¶
type AESCrypt struct {
// contains filtered or unexported fields
}
func NewAESCrypt ¶
func (*AESCrypt) Encode2Str ¶
func (*AESCrypt) NewNonceStr ¶
type OptFunc ¶
type OptFunc func(c *AESCrypt)
func OptWithDataByte ¶
func OptWithIStr ¶
func OptWithIStr(istr stringer) OptFunc
func OptWithKeyByte ¶
func OptWithNonceByte ¶
type RsaCrypt ¶
type RsaCrypt struct {
// contains filtered or unexported fields
}
func (*RsaCrypt) DecryptPKCS1v15 ¶
DecryptPKCS1v15 decrypts data with private key
func (*RsaCrypt) DecryptToString ¶
func (*RsaCrypt) DecryptToStringByHex ¶
func (*RsaCrypt) EncryptPKCS1v15 ¶
EncryptPKCS1v15 encrypts data with public key
func (*RsaCrypt) EncryptToString ¶
func (*RsaCrypt) EncryptToStringByHex ¶
func (*RsaCrypt) SetPrivateKey ¶
SetPrivateKey bytes to private key
func (*RsaCrypt) SetPrivateKeyByBase64Str ¶
SetPrivateKeyByBase64Str Get bytes data by decoding base64 string
func (*RsaCrypt) SetPublicKey ¶
SetPublicKey bytes to public key
func (*RsaCrypt) SetPublicKeyByBase64Str ¶
SetPublicKeyByBase64Str Get bytes data by decoding base64 string
Click to show internal directories.
Click to hide internal directories.