-
Notifications
You must be signed in to change notification settings - Fork 245
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
Implements hashing as a blanket trait for instances of CanonicalSerialize
#265
Conversation
e15b4c5
to
48847ee
Compare
…alize` - this saves an alllocation w.r.t the suggested approach by implementing `io::Write` on the input instance of `digest::Digest`, - note that most instances of `digest::Digest` [already](https://gist.github.com/huitseeker/e827161413063e347ce5a496b66ff287) have an [`io::Write` instance](https://github.com/rustcrypto/hashes#hashing-readable-objects), but `CanonicalSerialize` consuming its `io::Write` argument prevents its usage, - this hence implements `io::Write` on a [cheap newtype wrapper](https://rust-unofficial.github.io/patterns/patterns/behavioural/newtype.html) Fixes arkworks-rs#86
Is it not possible to work around this by doing |
@Pratyush Sure, though this signature change would change the API of Moreover, I'm not sure we want to depend on the
They're here .. just not very reliably so. |
Ok that makes sense, let's proceed as is. This LGTM modulo the change to |
- rename Hash -> CanonicalSerialize Ext according to [extension trait best practices](https://rust-lang.github.io/rfcs/0445-extension-trait-conventions.html#the-convention) - add the same structure for hashing uncompressed bytes
Oh @huitseeker if you could add a CHANGELOG entry that would be great (also for #263) |
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.
Thanks for adding this!
io::Write
on the input instance ofdigest::Digest
,digest::Digest
already have anio::Write
instance, butCanonicalSerialize
consuming itsio::Write
argument prevents its usage,io::Write
on a cheap newtype wrappercloses: #86
Pending
section inCHANGELOG.md
Files changed
in the Github PR explorer