encrypt

package
v0.0.0-...-9a41f76 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AES_KEY = "ZRxS9kLzR90GLpCFabUWMKAw"
View Source
var DES_KEY = "fBEznwcv"

Functions

func AESDecrypt

func AESDecrypt(crypt string, key string) (string, error)

AESDecrypt Aes解密 key: 24个字符

func AESEncrypt

func AESEncrypt(orig string, key string) (string, error)

AESEncrypt Aes加密 key: 24个字符

func Base64Decrypt

func Base64Decrypt(str string) (string, error)

Base64Decrypt Base64解密

func Base64Encrypt

func Base64Encrypt(str string) string

Base64Encrypt Base64加密

func BcryptComparePassword

func BcryptComparePassword(hashedPassword string, password string) error

BcryptComparePassword 判断密码是否正确 hashedPassword 加密密码 password 原始密码

func BcryptHashPassword

func BcryptHashPassword(password string) (string, error)

BcryptHashPassword bcrypt 加密 password 原始密码

func DESDecrypt

func DESDecrypt(data string, key []byte) string

DESDecrypt DES解密 key:8位

func DESEncrypt

func DESEncrypt(origData, key []byte) string

DESEncrypt DES加密 key:8位

func MD5

func MD5(value string) string

func PKCS5Padding

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

PKCS5Padding 实现明文的补码

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) []byte

PKCS5UnPadding 去除补码

func PKCS7Padding

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

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

func PKCS7UnPadding

func PKCS7UnPadding(origData []byte) []byte

PKCS7UnPadding 去码

func RSADecrypt

func RSADecrypt(ciphertext []byte) ([]byte, error)

RSADecrypt 解密

func RSAEncrypt

func RSAEncrypt(origData []byte) ([]byte, error)

RSAEncrypt 加密

func ScryptComparePassword

func ScryptComparePassword(storedPassword string, suppliedPassword string) (bool, error)

ScryptComparePassword 判断密码是否正确 storedPassword 加密密码 suppliedPassword 原始密码

func ScryptHashPassword

func ScryptHashPassword(password string) (string, error)

ScryptHashPassword scrypt 加密 password 原始密码

func Sha1

func Sha1(str string) string

Sha1 加密

func Sha256

func Sha256(str string) string

Sha256 加密

func Sha512

func Sha512(str string) string

Sha512 加密

func TripleDESDecrypt

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

TripleDESDecrypt 3DES解密 key:24位

func TripleDESEncrypt

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

TripleDESEncrypt 3DES加密 key:24位

Types

This section is empty.

Jump to

Keyboard shortcuts

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