16 lines
421 B
Go
16 lines
421 B
Go
package spectre
|
|
|
|
import "golang.org/x/crypto/scrypt"
|
|
|
|
func userKey(name, secret string, scoper Scoper) ([]byte, error) {
|
|
nameBytes := []byte(name)
|
|
secretBytes := []byte(secret)
|
|
keyScope := []byte(scoper.Scope(Authentication))
|
|
nameBytesLen := len(nameBytes)
|
|
|
|
keySalt := append(keyScope, bigEndian(nameBytesLen)...)
|
|
keySalt = append(keySalt, nameBytes...)
|
|
|
|
return scrypt.Key(secretBytes, keySalt, 32768, 8, 2, 64)
|
|
}
|