Parameterize cost factor N of scrypt
This commit is contained in:
parent
9567fb840d
commit
102d7c2d5f
2 changed files with 4 additions and 4 deletions
|
|
@ -25,7 +25,7 @@ func DecryptWithoutIntegrity(key, input, iv []byte) ([]byte, error) {
|
|||
return EncryptWithoutIntegrity(key, input, iv)
|
||||
}
|
||||
|
||||
// DeriveKey derives a key from a password using scrypt.
|
||||
func DeriveKey(password string, salt []byte) ([]byte, error) {
|
||||
return scrypt.Key([]byte(password), salt, 32768, 8, 1, 32)
|
||||
// DeriveKey derives a key from a password using scrypt. N should be set to the highest power of 2 you can derive within 100 milliseconds.
|
||||
func DeriveKey(password string, salt []byte, N int) ([]byte, error) {
|
||||
return scrypt.Key([]byte(password), salt, N, 8, 1, 32)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue