mirror of https://github.com/mitchell/selfpass.git
17 lines
272 B
Go
17 lines
272 B
Go
|
package crypto
|
||
|
|
||
|
import (
|
||
|
"crypto/sha256"
|
||
|
|
||
|
"golang.org/x/crypto/pbkdf2"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
PBKDF2Rounds = 4096
|
||
|
KeyLength = 32
|
||
|
)
|
||
|
|
||
|
func GeneratePBKDF2Key(password, salt []byte) []byte {
|
||
|
return pbkdf2.Key([]byte(password), []byte(salt), PBKDF2Rounds, KeyLength, sha256.New)
|
||
|
}
|