Documentation ¶
Overview ¶
************************** @File : SHA256Hash.go @Time : 2022/07/04 17:40:29 @AUTHOR : small_ant @Email : xms.chnb@gmail.com @Desc : sha256 ***************************
************************** @File : aes.go @Time : 2022/07/04 17:34:28 @AUTHOR : small_ant @Email : xms.chnb@gmail.com @Desc : aes encrypt ***************************
************************** @File : ecrecover.go @Time : 2022/03/29 17:59:39 @AUTHOR : small_ant @Email : xms.chnb@gmail.com @Desc : web3 sign ***************************
************************** @File : md5.go @Time : 2022/07/04 17:39:55 @AUTHOR : small_ant @Email : xms.chnb@gmail.com @Desc : md5 encrypt ***************************
Index ¶
- Variables
- func AesDecrypt(data []byte, key []byte) ([]byte, error)
- func AesEncrypt(data []byte, key []byte) ([]byte, error)
- func Base64Decode(str string) (string, []byte)
- func Base64Encode(str []byte) string
- func DecryptByAes(data string) ([]byte, error)
- func Ecrecover(hash, sig []byte) ([]byte, error)
- func EncryptByAes(data []byte) (string, error)
- func GetSHA256HashCode(message []byte) string
- func Md5Bytes(b []byte) string
- func Md5SaltString(str, md5Salt string) string
- func Md5String(str string) string
- func NullUnPadding(in []byte) []byte
- func SigRSV(isig interface{}) ([32]byte, [32]byte, uint8)
- func SigToPub(hash, sig []byte) (*ecdsa.PublicKey, error)
- func SignBuyOrder(hash string, key string) map[string]interface{}
- func SignMint(address string, tokenId int64, key string) map[string]interface{}
- func SignOrder(data []byte) string
- func SignTest()
- func VerifySig(from string, sigHex string, msg []byte) bool
- func ZeroPadding(in []byte) []byte
Constants ¶
This section is empty.
Variables ¶
var PwdKey = []byte("ABCDABCDABCDABCD")
16,24,32位字符串的话,分别对应AES-128,AES-192,AES-256 加密方法 key不能泄露
Functions ¶
func AesDecrypt ¶
AesDecrypt 解密 It decrypts the data using AES-CBC.
func AesEncrypt ¶
AesEncrypt 加密 It takes a byte array and a key, and returns a byte array
func Base64Encode ¶
base64 编码 Base64Encode takes a byte slice and returns a string.
func DecryptByAes ¶
DecryptByAes Aes 解密 It decrypts the data using AES.
func EncryptByAes ¶
EncryptByAes Aes加密 后 base64 再加 Encrypts the data using AES and returns the encrypted data in base64 format.
func GetSHA256HashCode ¶
SHA256生成哈希值 It takes a byte array as input, and returns a string as output
func Md5SaltString ¶
生成32位md5 salt加密字符串 It takes a string and a salt, and returns the MD5 hash of the string concatenated with the salt
func Md5String ¶
生成32位md5字符串 It takes a string, creates a new MD5 hash, writes the string to the hash, and then returns the hexadecimal representation of the hash
func NullUnPadding ¶
It removes all the null bytes from the end of the input byte array
func SignBuyOrder ¶
func SignMint ¶
It takes the address of the owner, the tokenId of the token to be minted, and the private key of the owner, and returns the signature of the minting transaction
func SignTest ¶
func SignTest()
It takes a message, hashes it, signs the hash with a private key, and returns the signature
func VerifySig ¶
It takes a message, a signature, and a public key, and returns true if the signature is valid for the message under the public key
func ZeroPadding ¶
If the length of the input is a multiple of 8, return the input, otherwise return the input with enough zero bytes appended to make the length a multiple of 8
Types ¶
This section is empty.