-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
When password has more than 72 bytes, it is truncated and the assumption may not hold true.
I wonder if L109 is necessary.
Lines 106 to 114 in b6af5e5
| // Passwords need to be null terminated | |
| let mut vec = Vec::with_capacity(password.len() + 1); | |
| vec.extend_from_slice(password); | |
| vec.push(0); | |
| // We only consider the first 72 chars; truncate if necessary. | |
| // `bcrypt` below will panic if len > 72 | |
| let truncated = if vec.len() > 72 { &vec[..72] } else { &vec }; | |
| let output = bcrypt::bcrypt(cost, salt, truncated); |
Metadata
Metadata
Assignees
Labels
No labels