-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Feature gate: #![feature(hasher_prefixfree_extras)]
This is a tracking issue for the new provided methods on Hasher added to fix #94026
write_strlets the hasher customize how it works withstr, so it can use theb'\xFF'trick if it's byte-wise, or a different approach if it does chunked rounds.write_length_prefixgives an obvious choice when implementingHashfor collections (likeVecDeque) which can't just use the slice hash, and allows the hasher to optimize how best to represent the length.
Public API
// core::hash
pub trait Hasher {
// ... existing stuff ...
fn write_length_prefix(&mut self, len: usize);
fn write_str(&mut self, s: &str);
}Steps / History
- Implementation: Add a dedicated length-prefixing method to
Hasher#94598 - Final comment period (FCP)
- Stabilization PR
Unresolved Questions
- What should the
write_strprovided implementation be? It was added matching the previousimpl Hash for strbehaviour to get in without breaking hash checks (like the one incargo), but that's not always prefix-free (it depends on the round strategy), so there's an argument that a different implementation would be better.
hoxxep and peter-lyons-kehl
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.