-
Notifications
You must be signed in to change notification settings - Fork 52
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
feat: add name and code fields to MultihashHasher interface #95
Conversation
This appears to have been missed off, unless it's been done on purpose. Makes `MultihashHasher` consistent with `MultibaseEncoder`, `BlockEncoder`, etc.
fewer requirements on interface is easier to satisfy, so unless there’s a compelling reason (which didn’t exist in multiformats at a time) it’s best to keep things out until necessary. And if it’s necessary in 20% of cases maybe separate interface for those is a better option still |
This will be useful to list configured hash algorithms in a way that is easily digestible for a human without consumers having to maintain their own lookup tables. For example
Good point, this should also be in the interface, as it is with |
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.
As it so happens, these last couple of days I've run into precisely this problem with some HAMT code. We record the multihash code for the algorithm used to hash entries in the root of the structure and I'm typing the interfaces now and it accepts a MultihashHasher
as your hash algorithm ... but I can't get code
off the interface!
So I'm fine with this, I think it's reasonable and I see multiple usecases for it.
This appears to have been missed off, unless it's been done on purpose?
Makes
MultihashHasher
consistent withMultibaseEncoder
,BlockEncoder
, etc.Also fixes a small typo.