Skip to content

Commit 2b60b27

Browse files
authored
docs: add PBKDF2 security notes
2 parents 51d5e93 + 8b47123 commit 2b60b27

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,14 @@ Parameters:
205205
For deployments with a server-side *pepper*, use `pbkdf2_with_pepper(password, salt, pepper, iters, dkLen)`.
206206
The pepper is a secret key stored separately from the hashed password.
207207
208+
### PBKDF2 Security Notes
209+
210+
- Use a random salt of **at least 16 bytes** and never reuse it.
211+
- Choose an iteration count that takes roughly **200–500 ms** on your target hardware (~2025).
212+
- Store `{salt, iterations}` alongside the ciphertext or hash; these values are public.
213+
- Salts and iteration counts must be unique per password.
214+
- Example serialization: `{magic|ver|prf|salt|iters|dkLen|…}`.
215+
208216
#### PBKDF2-HMAC-SHA256 + AES-GCM
209217
210218
```cpp

include/hmac_cpp/hmac_utils.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ namespace hmac_cpp {
5454
/// \brief Hash choices for PBKDF2
5555
enum class Pbkdf2Hash { Sha1, Sha256, Sha512 };
5656

57+
/// PBKDF2 Security Notes:
58+
/// - Use a random salt of at least 16 bytes and never reuse it.
59+
/// - Choose iterations so the derivation takes about 200–500 ms on 2025 hardware.
60+
/// - Store {salt, iterations} with the ciphertext or hash; these values are public.
61+
/// - Salts and iteration counts must be unique per password.
62+
/// - Example serialization: {magic|ver|prf|salt|iters|dkLen|…}.
63+
5764
/// \brief Derives a key from a password using PBKDF2 (RFC 8018)
5865
/// \param password_ptr Pointer to the password buffer
5966
/// \param password_len Length of the password in bytes

0 commit comments

Comments
 (0)