crypto

package
v0.0.0-...-6b90055 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RSA_KEY_SIZE = 1024
)

Variables

View Source
var (
	AesECB = aesECBImpl{}
	AesCBC = aesCBCImpl{}
	AesCFB = aesCFBImpl{}
	AesGCM = aesGCMImpl{}
)

Functions

func BcryptCheck

func BcryptCheck(password, hash string) bool

BcryptCheck 对比明文密码和数据库的哈希值

func BcryptHash

func BcryptHash(password string) string

BcryptHash 使用 bcrypt 对密码进行加密,密码必须小于72位

func ECCDecrypt

func ECCDecrypt(cipher []byte, prvKey *ecies.PrivateKey) (string, error)

ECCDecrypt 椭圆曲线解密

func ECCEncrypt

func ECCEncrypt(plain string, pubKey *ecies.PublicKey) ([]byte, error)

ECCEncrypt 椭圆曲线加密

func GenerateRsaKeys

func GenerateRsaKeys() (string, string)

func MD5V

func MD5V(str []byte, b ...byte) string

func Md5v

func Md5v(str string, salt string) string

Md5v md5 加盐加密

func Md5vMulti

func Md5vMulti(str string, salt string, iteration int) string

Md5vMulti iteration:加密次数

func Sha256v

func Sha256v(str string, salt string) string

Md5v md5 加盐加密

Types

type Aes

type Aes interface {
	AESEncrypt(plaintext []byte, key []byte, iv ...byte) (ciphertext []byte, err error)
	AESDecrypt(ciphertext []byte, key []byte, iv ...byte) (plaintext []byte, err error)
}

Jump to

Keyboard shortcuts

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