samuel-lucas6 / draft-lucas-bkdf

An Internet-Draft for the Balloon Key Derivation Function (BKDF), a memory-hard password hashing and password-based key derivation function.
Other
4 stars 1 forks source link

Prevent canonicalization attacks #12

Closed samuel-lucas6 closed 3 months ago

samuel-lucas6 commented 3 months ago

The current concatenation of the password and salt means you can shift bytes between the two parameters and get the same output, which should not be possible.

The easiest way to fix this is to append the lengths. Technically, one length will do but both are normally included in practice (e.g., in AEAD schemes).