-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expand ID range to harden brute forcing #71
base: master
Are you sure you want to change the base?
Conversation
If I see correctly, this will break all existing paste ids? |
Added backwards compatibility. |
Expand the domain for IDs from 2^32 to 2^64, resulting in keys of length 11 instead of 6. In particular important for one-time-pastes. i64 is used as inner type since sqlite does not support storing u64.
} | ||
|
||
#[test] | ||
fn convert_id_from_string() { | ||
assert!(Id::from_str("abDE+-").is_ok()); | ||
/* Support ID generated in the old 32-bit format */ | ||
//assert!(Id::from_str("abDE+-").is_ok()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this outcommented? Also, please use proper Rust comments, i.e. //
instead of /* */
.
s.push(CHAR_TABLE[(self.n & 0x3) as usize]); | ||
|
||
write!(f, "{s}") | ||
#[allow(clippy::cast_sign_loss)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔
|
||
/// Represents a 32-bit integer either numerically or mapped to a 6 character string. | ||
pub type Inner = i64; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stupid question: what's the point of this type alias?
Expand the value space from 2^32 to 2^64, resulting in keys of length 11 instead of 6.
In particular important for one-time-pastes.
i64 is used as inner type since sqlite does not support storing u64.