(password string, seed []byte, pub *rsa.PublicKey)
| 79 | } |
| 80 | |
| 81 | func 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 |
| 93 | func AppendLengthEncodedInteger(b []byte, n uint64) []byte { |
no outgoing calls
no test coverage detected