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
Keccak + SHA3 #12
Keccak + SHA3 #12
Conversation
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.
Thank you, to minor requests :)
Cargo.toml
Outdated
@@ -5,7 +5,7 @@ homepage = "https://github.com/multiformats/rust-multihash" | |||
|
|||
keywords = ["multihash", "ipfs"] | |||
|
|||
version = "0.4.2" | |||
version = "0.4.3" |
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.
Can you remove this? I like to make version bumps its own commit, so I can tag it.
tests/lib.rs
Outdated
Hash::SHA2512 | ||
assert_decode!( | ||
SHA1, SHA2256, SHA2512, SHA3224, SHA3256, SHA3384, SHA3512, | ||
Keccak224, Keccak256, Keccak384, Keccak512 |
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.
while you are in here, could you add a roundtrip macro test as well please?
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.
decoding was already a roundtrip test, added new ones for decoding from a predefined hashes instead
🎉 |
Instead of deriving a Multihash enum, derive from a Code enum. This commit also combines the previously generated `Multihash` enum with the `RawMultihash` struct. There is now a single `Multihash` type which is generic over its digest size. The derived `Code` enum is used for hashing, the `Multihash` only contains static, general data. Closes #12, #13.
* feat: derive from Code enum Instead of deriving a Multihash enum, derive from a Code enum. This commit also combines the previously generated `Multihash` enum with the `RawMultihash` struct. There is now a single `Multihash` type which is generic over its digest size. The derived `Code` enum is used for hashing, the `Multihash` only contains static, general data. Closes #12, #13. * fix: don't clone the digest * feat: introduce `max_size` attribute The digests are stack allocated. We cannot determine the biggest digest size that is used at compile time, hence you need to specify the maximum allocated size your custom code table should use via `[#mh(max_size = …)]` on the enum you derive the table from. * fix: enable the arb module again * fix: properly use local versions of imports This way you only need to import the derive and not also additional (seemingly unrelated) types. * fix: make Serde support work again * fix: make Parity Scale Codec support work again * feat: create MultihashCode trait Instead of just implementing it on the code enum, use a trait instead. This way other libraries can create digests without knowing the concrete type.
No description provided.