Skip to content

Conversation

@jedisct1
Copy link
Contributor

@jedisct1 jedisct1 commented Jun 4, 2023

bcrypt has a slightly annoying limitation: passwords are limited to 72 characters. In the original implementation, additional characters are silently ignored.

When they care, applications adopt different strategies to work around this, in incompatible ways.

Ideally, large passwords should be pre-hashed using a hash function that hinders GPU attackers, and the hashed function should not be deterministic in order to defeat shucking attacks.

This change improves the developer experience by adding a very explicit silently_truncate_password option, that can be set to false in order to do that automatically, and consistently across Zig applications.

By default, passwords are still truncated, so this is not a breaking change.

Add some inline documentation for our beloved autodoc by the way.

bcrypt has a slightly annoying limitation: passwords are limited
to 72 characters. In the original implementation, additional characters
are silently ignored.

When they care, applications adopt different strategies to work around
this, in incompatible ways.

Ideally, large passwords should be pre-hashed using a hash function that
hinders GPU attackers, and the hashed function should not be deterministic
in order to defeat shucking attacks.

This change improves the developer experience by adding a very explicit
`silently_truncate_password` option, that can be set to `false` in
order to do that automatically, and consistently across Zig applications.

By default, passwords are still truncated, so this is not a breaking
change.

Add some inline documentation for our beloved autodoc by the way.
@jedisct1 jedisct1 merged commit 9ee0a70 into ziglang:master Jun 6, 2023
@jedisct1 jedisct1 deleted the bcrypt-hmac branch June 6, 2023 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant