1
0
mirror of https://github.com/gilbertchen/duplicacy synced 2025-12-13 14:53:28 +00:00

Use random salt and make the number of iterations configurable for storage key derivation

This commit is contained in:
Gilbert Chen
2017-10-20 23:21:26 -04:00
parent c08a26a0c2
commit 9608a7f6b6
5 changed files with 137 additions and 43 deletions

View File

@@ -159,8 +159,8 @@ func RateLimitedCopy(writer io.Writer, reader io.Reader, rate int) (written int6
}
// GenerateKeyFromPassword generates a key from the password.
func GenerateKeyFromPassword(password string) []byte {
return pbkdf2.Key([]byte(password), DEFAULT_KEY, 16384, 32, sha256.New)
func GenerateKeyFromPassword(password string, salt []byte, iteartions int) []byte {
return pbkdf2.Key([]byte(password), salt, iteartions, 32, sha256.New)
}
// Get password from preference, env, but don't start any keyring request