Skip to content

pbkdf2 output size too high #7

@Terebi42

Description

@Terebi42

A major issue is that you are pulling 64 bytes from deriveBytes, which is very expensive for almost no additional gain. You should be pulling a maximum of 20 bytes. This is causing your routine to run ~4x slower (each 20 bytes doubles costs. and you eat an entire x to generate those last 4 bytes), for no additional security gain (as attackers can generate only the first 20 bytes, and once they get a match there, calculate the remaining bytes)

See
https://stackoverflow.com/questions/14394803/how-can-pbkdf2-using-hmac-sha-1-return-more-than-20-bytes

or
https://www.owasp.org/index.php/Using_Rfc2898DeriveBytes_for_PBKDF2

"Using PBKDF2 for password storage, one should never output more bits than the base hash function's size. With PBKDF2-SHA1 this is 160 bits or 20 bytes. Output more bits doesn't make the hash more secure, but it costs the defender a lot more time while not costing the attacker. An attacker will just compare the first hash function sized output saving them the time to generate the reset of the PBKDF2 output"

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions