-
Notifications
You must be signed in to change notification settings - Fork 357
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
digest v0.10 #212
Comments
Updating to digest v0.10 should be pretty natural as soon as that stabilizes. We've make a clear "no compatibility guarantees" note in our docs around this. For the lower-level |
Note that |
I've spent 45 minutes trying to add trait impls to let me instantiate an I've hacked together a few new impls like this: impl digest::core_api::BlockSizeUser for Hasher {
type BlockSize = typenum::U64;
}
impl digest::core_api::BufferKindUser for Hasher {
type BufferKind = block_buffer::Lazy;
}
impl digest::core_api::UpdateCore for Hasher {
fn update_blocks(&mut self, blocks: &[digest::core_api::Block<Self>]) {
for block in blocks {
// TODO: we need to use larger slices here to avoid a performance hit
self.update(block);
}
}
} These aren't sufficient, though, and the errors I'm seeing look like this:
Despite this error message, I don't imagine I'm actually supposed to implement Subjectively, this has been surprisingly complicated. Part of the problem is that |
@oconnor663 See #223 (comment). I don't think it's possible for blake3 to work with Hmac. See https://docs.rs/hmac/latest/hmac/struct.SimpleHmac.html
|
In RustCrypto we plan to soon migrate our hash crates to digest v0.10, see RustCrypto/traits#819 and RustCrypto/hashes#217.
Probably the most notable change is that
crypto-mac
got merged intodigest
, so it should simplify a bit implementation of traits in your case. Most mid-level traits (Update
,FixedOutput
, etc.) haven't changed much, so migration should be relatively simple.But I wonder if you will be interested in using the new block-level traits (see the
core_api
module). By implementing them, buffering can be handled automatically by theCoreWrapper
type. There are also wrappers which handle switch between runtime and compile-time selection of output size. Notably, theblock-buffer
which is used by the wrapper types is designed to completely eliminate unreachable panics in buffering code withoutunsafe
code in hash implementation crates.If you have any comments, questions or suggestions about the new API, I will be happy to hear them out.
The text was updated successfully, but these errors were encountered: