crypto

package
v0.0.0-...-cb5d853 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

README

Crypto

一些常用的加密解密功能

安装

go get github.com/williambao/gocrypto

文档

太过简单, 请直接看代码吧.

包含
  • MD5加密
  • Base64加密/解密
  • 生成40位随机数(GetRandomKey)
  • AES加密/解密

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESDecode

func AESDecode(data string, key string) (string, error)

解密

func AESDecodeByte

func AESDecodeByte(data []byte, key []byte) ([]byte, error)

func AESEncode

func AESEncode(data string, key string) (string, error)

加密

func AESEncodeByte

func AESEncodeByte(data []byte, key []byte) ([]byte, error)

func AesDecrypt

func AesDecrypt(crypted, key []byte) ([]byte, error)

AES解密

func AesEncrypt

func AesEncrypt(origData, key []byte) ([]byte, error)

AES加密

func Base64Decode

func Base64Decode(data string) (string, error)

func Base64DecodeByte

func Base64DecodeByte(data []byte) ([]byte, error)

func Base64Encode

func Base64Encode(data string) string

func Base64EncodeByte

func Base64EncodeByte(data []byte) []byte

func CheckMD5

func CheckMD5(data string, sum string) bool

func GetHmacSha1

func GetHmacSha1(data string, key string) string

func GetMD5

func GetMD5(data string) string

func GetRandomKey

func GetRandomKey() string

func GetSha1

func GetSha1(data string) string

func MD5Byte

func MD5Byte(byts []byte) string

func MD5Str

func MD5Str(str string) string

func MD5V

func MD5V(str string) string

func PKCS7Padding

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

func PKCS7UnPadding

func PKCS7UnPadding(origData []byte) []byte

func RandomDigits

func RandomDigits(length int) []byte

RandomDigits returns a byte slice of the given length containing pseudorandom numbers in range 0-9. The slice can be used as a captcha solution.

Types

This section is empty.

Jump to

Keyboard shortcuts

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