You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use feature "error_on_truncation" to send error on truncation (#89)
* Use feature "error_on_truncation" to send error on truncation * Added documentation * Mentioned most implementations truncate by default; one should enable error_on_truncation after careful consideration * Revert error_on_truncation feature * Users can choose to enforce truncation using non_truncating_* implementations * verify and non_truncating_verify both call _verify, only with different value for err_on_truncation
Copy file name to clipboardExpand all lines: README.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,9 @@ let valid = verify("hunter2", &hashed)?;
27
27
28
28
The cost needs to be an integer between 4 and 31 (see benchmarks to have an idea of the speed for each), the `DEFAULT_COST` is 12.
29
29
30
+
## Error on truncation
31
+
Most if not all bcrypt implementation truncates the password after 72 bytes. In specific use cases this can break 2nd pre-image resistance. One can enforce the 72-bytes limit on input by using `non_truncating_hash`, `non_truncating_hash_with_result`, `non_truncating_hash_with_salt`, and `non_truncating_verify`. The `non_truncating_*` functions behave identically to their truncating counterparts unless the input is longer than 72 bytes, in which case they will return `BcryptError::Truncation`.
32
+
30
33
## `no_std`
31
34
32
35
`bcrypt` crate supports `no_std` platforms. When `alloc` feature is enabled,
0 commit comments