Documentation ¶
Index ¶
- Constants
- Variables
- func AesCBCDecrypt(src, key, iv []byte, padding string) ([]byte, error)
- func AesCBCEncrypt(src, key, iv []byte, padding string) ([]byte, error)
- func AesECBDecrypt(src, key []byte, padding string) ([]byte, error)
- func AesECBEncrypt(src, key []byte, padding string) ([]byte, error)
- func AesNewCipher(key []byte) (cipher.Block, error)
- func CBCDecrypt(block cipher.Block, src, iv []byte, padding string) ([]byte, error)
- func CBCEncrypt(block cipher.Block, src, iv []byte, padding string) ([]byte, error)
- func Des3CBCDecrypt(src, key, iv []byte, padding string) ([]byte, error)
- func Des3CBCEncrypt(src, key, iv []byte, padding string) ([]byte, error)
- func Des3ECBDecrypt(src, key []byte, padding string) ([]byte, error)
- func Des3ECBEncrypt(src, key []byte, padding string) ([]byte, error)
- func DesCBCDecrypt(src, key, iv []byte, padding string) ([]byte, error)
- func DesCBCEncrypt(src, key, iv []byte, padding string) ([]byte, error)
- func DesECBDecrypt(src, key []byte, padding string) ([]byte, error)
- func DesECBEncrypt(src, key []byte, padding string) ([]byte, error)
- func DesNewCipher(key []byte) (cipher.Block, error)
- func ECBDecrypt(block cipher.Block, src []byte, padding string) ([]byte, error)
- func ECBEncrypt(block cipher.Block, src []byte, padding string) ([]byte, error)
- func HmacSha1(key string, data string) []byte
- func HmacSha1ToString(key string, data string) string
- func HmacSha256(key string, data string) []byte
- func HmacSha256ToString(key string, data string) string
- func KeyGenerator(src []byte, blockSize int) []byte
- func Md5(str string) []byte
- func Md5ToString(str string) string
- func NewECBDecrypter(b cipher.Block) cipher.BlockMode
- func NewECBEncrypter(b cipher.Block) cipher.BlockMode
- func PKCS5Padding(src []byte, blockSize int) []byte
- func PKCS5Unpadding(src []byte) ([]byte, error)
- func PKCS7Padding(src []byte, blockSize int) []byte
- func PKCS7UnPadding(src []byte) ([]byte, error)
- func Padding(padding string, src []byte, blockSize 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) []byte
- func Sha1(str string) []byte
- func Sha256(str string) []byte
- func UnPadding(padding string, src []byte) ([]byte, error)
- func ZerosPadding(src []byte, blockSize int) []byte
- func ZerosUnPadding(src []byte) ([]byte, error)
Constants ¶
const PKCS5_PADDING = "PKCS5"
const PKCS7_PADDING = "PKCS7"
const ZEROS_PADDING = "ZEROS"
Variables ¶
var ErrInvalidFormat = errors.New("key is invalid format")
var ErrUnPadding = errors.New("UnPadding error")
Functions ¶
func AesCBCDecrypt ¶
AesCBCDecrypt
func AesCBCEncrypt ¶
AesCBCEncrypt
func AesECBDecrypt ¶
AesECBDecrypt
func AesECBEncrypt ¶
AesECBEncrypt
func AesNewCipher ¶
AesNewCipher creates and returns a new AES cipher.Block. it will automatically pad the length of the key.
func CBCDecrypt ¶
CBCDecrypt
func CBCEncrypt ¶
CBCEncrypt
func Des3CBCDecrypt ¶
Des3CBCDecrypt
func Des3CBCEncrypt ¶
Des3CBCEncrypt
func Des3ECBDecrypt ¶
Des3ECBDecrypt
func Des3ECBEncrypt ¶
Des3ECBEncrypt
func DesCBCDecrypt ¶
DesCBCDecrypt
func DesCBCEncrypt ¶
DesCBCEncrypt
func DesECBDecrypt ¶
DesECBDecrypt
func DesECBEncrypt ¶
DesECBEncrypt
func DesNewCipher ¶
DesNewCipher creates and returns a new DES cipher.Block.
func HmacSha1ToString ¶
HmacSha1ToString Calculate the sha1 hash of a string using the HMAC method, outputs lowercase hexits
func HmacSha256 ¶
HmacSha256 Calculate the sha256 hash of a string using the HMAC method
func HmacSha256ToString ¶
HmacSha256ToString Calculate the sha256 hash of a string using the HMAC method, outputs lowercase hexits
func KeyGenerator ¶
func Md5ToString ¶
Md5ToString Calculate the md5 hash of a string, return hex string
func NewECBDecrypter ¶
NewECBDecrypter returns a BlockMode which decrypts in electronic code book mode, using the given Block.
func NewECBEncrypter ¶
NewECBEncrypter returns a BlockMode which encrypts in electronic code book mode, using the given Block.
func PKCS5Padding ¶
func PKCS5Unpadding ¶
func PKCS7Padding ¶
func PKCS7UnPadding ¶
func RSAGenerateKey ¶
RSAGenerateKey generate RSA private key
func RSAGeneratePublicKey ¶
RSAGeneratePublicKey generate RSA public key
func ZerosPadding ¶
func ZerosUnPadding ¶
Types ¶
This section is empty.