-
Notifications
You must be signed in to change notification settings - Fork 40
feat: hashing #517
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: hashing #517
Conversation
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## main #517 +/- ##
==========================================
+ Coverage 78.78% 78.89% +0.11%
==========================================
Files 99 100 +1
Lines 23184 23452 +268
Branches 23184 23452 +268
==========================================
+ Hits 18265 18502 +237
- Misses 2719 2742 +23
- Partials 2200 2208 +8
🚀 New features to boost your workflow:
|
AlexD10S
left a comment
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.
Just tested it, not a code review. Really nice and clean feature to use.
I like that there's no new dependency introduced, so I'm not sure there's much benefit to putting it behind an experimental flag.
|
It's experimental until some of the other useful commands in the listed resources land and the overall command structure can be stabilised. |
c4d33f8 to
7990570
Compare
AlexD10S
left a comment
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.
Nice work! The code is clean, well-organized, and very easy to review. The only change I’d propose is to replace the println! with our CLI module for the output, just to keep things consistent. Other than that, this looks good to approve and merge!
6bd655b to
18b1408
Compare
Based on https://www.shawntabrizi.com/substrate-js-utilities/ and https://github.com/hack-ink/subalfred, adds a simple
hashcommand as an additional utility to the CLI. It is feature gated behindexperimentalfor now. It supports all the hashers typically used by the SDK (blake2, keccack, sha2, twox), without taking on any new dependencies.Installation
Usage
There is a subcommand for each supported hasher, which expects the required length of the output along with input data in the form of a string, hex or path to a file to be hashed. The command structure is intended to be as simple as possible, whilst also allowing easier future extensibility. Whilst the commands could be combined with the output length (e.g. keccak-256), its the same amount of characters to type and providing the length separately makes it more natural in terms of how a hasher works imo. Possible values for length are included in
--help.Some of the commands also support an additional
--concatoption which can be used for storage key hashing.TODOs:
[sc-3512]