fix(general): change pbkdf2 min salt length to 16 bytes (#3864)

Changing the minimum salt length of Pbkdf2 key derivation
algorithm to the NIST recommended minimum of 16 bytes.

This matches the minimum salt for scrypt-based key derivation.
This commit is contained in:
Sirish Bathina authored and GitHub committed 2024-05-13 15:10:37 -07:00
1 parent 2b92388286
commit 05fedcff60
1 file changed
+4 -4
+4 -4
View File
@@ -11,13 +11,13 @@ const (
// Pbkdf2Algorithm is the key for the pbkdf algorithm.
Pbkdf2Algorithm = "pbkdf2-sha256-600000"
// The NIST recommended minimum size for a salt for pbkdf2 is 16 bytes.
//
// However, a good rule of thumb is to use a salt that is the same size
// A good rule of thumb is to use a salt that is the same size
// as the output of the hash function. For example, the output of SHA256
// is 256 bits (32 bytes), so the salt should be at least 32 random bytes.
// See: https://crackstation.net/hashing-security.htm
pbkdf2Sha256MinSaltLength = 32 // 256 bits
//
// However, the NIST recommended minimum size for a salt for pbkdf2 is 16 bytes.
pbkdf2Sha256MinSaltLength = 16 // 128 bits
// The NIST recommended iterations for PBKDF2 with SHA256 hash is 600,000.
pbkdf2Sha256Iterations = 600_000