GithubHelp home page GithubHelp logo

Comments (12)

vmx avatar vmx commented on June 26, 2024 1

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.

thomaseizinger avatar thomaseizinger commented on June 26, 2024 1

I think we can close this then? :)

from rust-multihash.

DougAnderson444 avatar DougAnderson444 commented on June 26, 2024

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.

thomaseizinger avatar thomaseizinger commented on June 26, 2024

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.

DougAnderson444 avatar DougAnderson444 commented on June 26, 2024

@thomaseizinger absolutely of course. Plus, they already exist!

https://github.com/multiformats/multicodec/blob/df81972d764f30da4ad32e1e5b778d8b619de477/table.csv#L15-L16

from rust-multihash.

thomaseizinger avatar thomaseizinger commented on June 26, 2024

@thomaseizinger absolutely of course. Plus, they already exist!

multiformats/multicodec@df81972/table.csv#L15-L16

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.

DougAnderson444 avatar DougAnderson444 commented on June 26, 2024

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.

thomaseizinger avatar thomaseizinger commented on June 26, 2024

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.

DougAnderson444 avatar DougAnderson444 commented on June 26, 2024

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.

vmx avatar vmx commented on June 26, 2024

@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.

thomaseizinger avatar thomaseizinger commented on June 26, 2024

@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.

DougAnderson444 avatar DougAnderson444 commented on June 26, 2024

Yep! Thanks for the feedback gents, this helped a lot.

from rust-multihash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.