Comments (12)
The currently released rust-multihash version, is kind of "catch all" for all sorts of hash function. Current master has already split things into smaller pieces. In theory it should be possible to implement other hash functions outside of this crate an integrate it in your own custom code table.
If anyone wants to give it a try, that would be great. If there are then issues, I'm happy to help.
from rust-multihash.
I think we can close this then? :)
from rust-multihash.
I can give that a try, but would that mean I need to also assign a code for Sha3 SHAKE128 and Sha3 SHAKE256? What would that do for interoperability if there are multiple implementations... with potentially different codes?
Also, if I do need to pick a code, should I just keep going with the Sha3 sequence (0x18
, 0x19
...)
from rust-multihash.
I can give that a try, but would that mean I need to also assign a code for Sha3 SHAKE128 and Sha3 SHAKE256? What would that do for interoperability if there are multiple implementations... with potentially different codes?
Also, if I do need to pick a code, should I just keep going with the Sha3 sequence (
0x18
,0x19
...)
Code assignment should happen in the multicodec
repository: https://github.com/multiformats/multicodec
from rust-multihash.
@thomaseizinger absolutely of course. Plus, they already exist!
from rust-multihash.
@thomaseizinger absolutely of course. Plus, they already exist!
Then all that is needed is an implementation :)
In the simplest case, you can construct a Multihash
with the correct code and the hashed digest. See https://github.com/multiformats/rust-multihash/pull/289/files#diff-b3696301e6450e80cb6418ed8cf625a5db0a2cd4acf9e4d2e446b00fef092b72R20 for example.
Note that we have heavily restructured this repository to make the base data structure nearly dependency free. This is not released yet but hopefully soon.
from rust-multihash.
Sounds amazing! The goods news is for Shake, no additional dependencies are required we already have sha3
. Just need a slightly modified macro, which I've already built 🚀. Happy to request a pull if you want to take on another one of my PRs...
from rust-multihash.
Sounds amazing! The goods news is for Shake, no additional dependencies are required we already have
sha3
. Just need a slightly modified macro, which I've already built 🚀. Happy to request a pull if you want to take on another one of my PRs...
Would you like to see it in multihash-codetable
? I am ambivalent :)
from rust-multihash.
That is what I was originally thinking, yes. But perhaps it's unnecessary. Here's what I've been able to do outside the library without any changes:
https://github.com/DougAnderson444/shake-multihash
The Shake derive macro I wrote is pretty close to derive_rustcrypto_hasher
, but the thing about SHAKE is the user is supposed to be able to pick their digest length, so the library needs to export the macro to be able to support that.
Maybe just leave it for now, if the crowds want it integrated badly it's straightforward to upgrade.
from rust-multihash.
@DougAnderson444 oh wow, this is nice! I actually would prefer keeping it outside of multihsah-codetable
as it nicely shows, how people can add their own hash functions to the ecosystem. I'll probably keep people pointing to that repo, if anyone requests adding a new hash function.
It's so great to see the library being used as imagined. Thanks!
from rust-multihash.
@DougAnderson444 Relating to https://github.com/DougAnderson444/shake-multihash/blob/9cbd3b09272f5053d241afa9ea775692048f5bfe/src/lib.rs#L19-L20, in case you didn't know, this also works:
pub const SHAKE_128_HASH_CODE: u64 = 0x18;
from rust-multihash.
Yep! Thanks for the feedback gents, this helped a lot.
from rust-multihash.
Related Issues (20)
- Implement ripemd160 HOT 3
- CI tries to run `fmt` with unstable feature and will always fail HOT 2
- Nix build is currently broken HOT 3
- Maintain a CHANGELOG.md HOT 3
- Let's make fewer breaking changes HOT 14
- Replace or Upgrade Tarpaulin Code Coverage HOT 2
- Split crate into `multihash`, `multihash-codetable` and `multihash-derive` HOT 5
- Tracking issue: Polish and stabilize the API HOT 5
- Use `sha1` dependency instead of `sha-1`
- Unsafe unwrap could cause an application to panic HOT 12
- Consider removing `MultihashDigest` and `Hasher` traits
- Write docs for transition to new crate structure HOT 6
- Parity Codec bumps MSRV to `1.64.0` HOT 4
- Add `cargo semver-checks` to CI to ensure we don't break the API accidentially HOT 1
- Only enforce MSRV if no features are activated
- Release 0.19 HOT 8
- multihash const constructors unusable HOT 5
- Redesign multihash::Error
- regression serde feature does not work with no-std
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-multihash.