ec

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 16 Imported by: 1

README

  • MD5信息摘要算法是一种被广泛使用的密码散列函数,可以产生出一个128位(16进制,32个字符)的散列值(hash value),用于确保信息传输完整一致。
  • HMAC是密钥相关的哈希运算消息认证码(Hash-based Message Authentication Code)的缩写,它通过一个标准算法,在计算哈希的过程中,把key混入计算过程中。和我们自定义的加salt算法不同,Hmac算法针对所有哈希算法都通用,无论是MD5还是SHA-1。采用Hmac替代我们自己的salt算法,可以使程序算法更标准化,也更安全。
  • HA-1可以生成一个被称为消息摘要的160位(20字节)散列值,散列值通常的呈现形式为40个十六进制数。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecryptCBC

func AesDecryptCBC(encrypted []byte, key []byte) (decrypted []byte)

func AesDecryptCFB

func AesDecryptCFB(encrypted []byte, key []byte) (decrypted []byte)

func AesDecryptECB

func AesDecryptECB(encrypted []byte, key []byte) (decrypted []byte)

func AesEncryptCBC

func AesEncryptCBC(origData []byte, key []byte) (encrypted []byte)

=================== CBC ====================== AesEncryptCBC aes-密码分组链接模式

func AesEncryptCFB

func AesEncryptCFB(origData []byte, key []byte) (encrypted []byte)

=================== CFB ======================

func AesEncryptECB

func AesEncryptECB(origData []byte, key []byte) (encrypted []byte)

=================== ECB ====================== AesEncryptECB 电码本模式

func GetMd5String

func GetMd5String(s string) string

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blocksize int) []byte

补码 AES加密数据块分组长度必须为128bit(byte[16]),密钥长度可以是128bit(byte[16])、192bit(byte[24])、256bit(byte[32])中的任意一个。

func PKCS7UnPadding

func PKCS7UnPadding(origData []byte) []byte

去码

func RSA_Decrypt

func RSA_Decrypt(src []byte, privateKey *rsa.PrivateKey) ([]byte, error)

rsa私匙解密

func RSA_DecryptByPem

func RSA_DecryptByPem(src []byte, file string) ([]byte, error)

RSA_DecryptByPem 通过Pem文件解码

func RSA_Encrypt

func RSA_Encrypt(src []byte, publickey *rsa.PublicKey) ([]byte, error)

rsa公匙加密

func RSA_GenKeys

func RSA_GenKeys(bits int) (privateKey *rsa.PrivateKey, publicKey *rsa.PublicKey, err error)

func RSA_GenPemFiles

func RSA_GenPemFiles(dir string, bits int) error

RSA_GenPemFiles

func RSA_GenPems

func RSA_GenPems(privateKeyWriter, publicKeyWriter io.Writer, bits int) error

RSA_GenPems 产生公钥私钥对应的pem文件

func RSA_JSEncrypt

func RSA_JSEncrypt(msg string, privateData []byte) string

RSA_JSEncrypt 用于用户名、密码解密

func RSA_JSEncryptByPem added in v1.1.1

func RSA_JSEncryptByPem(msg string, privatePemPath string) string

RSA_JSEncrypt 用于用户名、密码解密

func RSA_PrivateKeyFromBytes

func RSA_PrivateKeyFromBytes(priByte []byte) (*rsa.PrivateKey, error)

解析私匙

func RSA_PrivateKeyFromFile

func RSA_PrivateKeyFromFile(file string) (*rsa.PrivateKey, error)

解析私匙

func RSA_PublicKeyFromBytes

func RSA_PublicKeyFromBytes(pubByte []byte) (*rsa.PublicKey, error)

解析公匙

func RSA_PublicKeyFromFile

func RSA_PublicKeyFromFile(file string) (*rsa.PublicKey, error)

解析公匙

func Sha1

func Sha1(data string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL