You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
421 B

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)
}