MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / EncryptPassword

Function EncryptPassword

IceFireDB-SQLite/pkg/mysql/mysql/util.go:81–90  ·  view source on GitHub ↗
(password string, seed []byte, pub *rsa.PublicKey)

Source from the content-addressed store, hash-verified

79}
80
81func EncryptPassword(password string, seed []byte, pub *rsa.PublicKey) ([]byte, error) {
82 plain := make([]byte, len(password)+1)
83 copy(plain, password)
84 for i := range plain {
85 j := i % len(seed)
86 plain[i] ^= seed[j]
87 }
88 sha1v := sha1.New()
89 return rsa.EncryptOAEP(sha1v, rand.Reader, pub, plain, nil)
90}
91
92// AppendLengthEncodedInteger: encodes a uint64 value and appends it to the given bytes slice
93func AppendLengthEncodedInteger(b []byte, n uint64) []byte {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected