Skip to content
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

Merged
merged 4 commits into from Feb 6, 2017
Merged

Keccak + SHA3 #12

merged 4 commits into from Feb 6, 2017

Conversation

maciejhirsz
Copy link
Contributor

No description provided.

Copy link
Member

@dignifiedquire dignifiedquire left a 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"
Copy link
Member

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
Copy link
Member

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?

Copy link
Contributor Author

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

@dignifiedquire dignifiedquire merged commit 005ebda into multiformats:master Feb 6, 2017
@dignifiedquire
Copy link
Member

🎉

vmx added a commit that referenced this pull request Sep 30, 2020
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.
vmx pushed a commit that referenced this pull request Sep 30, 2020
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants