1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 00:22:41 +08:00

加密包装

This commit is contained in:
2022-03-27 10:21:30 +08:00
parent 22f41aeeeb
commit 12865abe26
14 changed files with 1068 additions and 0 deletions

42
crypto/utils.go Normal file
View File

@ -0,0 +1,42 @@
package crypto
import "crypto"
type Hash uint
const (
MD4 Hash = 1 + iota // import golang.org/x/crypto/md4
MD5 // import crypto/md5
SHA1 // import crypto/sha1
SHA224 // import crypto/sha256
SHA256 // import crypto/sha256
SHA384 // import crypto/sha512
SHA512 // import crypto/sha512
MD5SHA1 // no implementation; MD5+SHA1 used for TLS RSA
RIPEMD160 // import golang.org/x/crypto/ripemd160
SHA3_224 // import golang.org/x/crypto/sha3
SHA3_256 // import golang.org/x/crypto/sha3
SHA3_384 // import golang.org/x/crypto/sha3
SHA3_512 // import golang.org/x/crypto/sha3
SHA512_224 // import crypto/sha512
SHA512_256 // import crypto/sha512
BLAKE2s_256 // import golang.org/x/crypto/blake2s
BLAKE2b_256 // import golang.org/x/crypto/blake2b
BLAKE2b_384 // import golang.org/x/crypto/blake2b
BLAKE2b_512 // import golang.org/x/crypto/blake2b
SM3 // import
)
const (
defaultRsaBits = 1024
)
type hashOptions struct {
h crypto.Hash
}
func (o *hashOptions) getHash(msg []byte) []byte {
h := o.h.New()
h.Write(msg)
return h.Sum(nil)
}