-
Notifications
You must be signed in to change notification settings - Fork 69
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
Add SHA-512/256 hash op and FIXED32_LITTLE length op #39
Conversation
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.
Thanks for this PR and nice to point out https://github.com/confio/ics23/pull/39/files#diff-946b8d2ee64b4b178e19710fbd2c831353ccef71968db74f051f482ca747afb4R167-R171
We aim to keep all 3 language implementations in sync, so this needs to be implemented for rust and typescript (in other folders).
If you can implement them, that would be great. If not, I will put this on my TODO list.
Whoops, missed that, yeah I can add the other implementations. |
f3c90cd
to
988ab08
Compare
@ethanfrey Added the rest, Javascript is the most annoying. |
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.
Looks good. One minor comment.
If you do fix that, please run cargo fmt
on the rust code as well. Then it is good to merge.
js/src/ops.ts
Outdated
let l = n; | ||
for (let i = enc.length; i > 0; i--) { | ||
/* tslint:disable */ | ||
enc[Math.abs(i - enc.length)] = l; |
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.
I would do = (l % 256)
. That is quite clear what you want. I think this will happen automatically in JS, but it is harder to review and ensure correctness.
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.
Yeah makes sense, I prefer bitwise ops (e.g., l & 0xFF
), but the linter doesn't like them for some reason.
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.
Changed.
988ab08
to
346d8d9
Compare
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.
Looks good. Thanks for your contribution.
I pushed 0.6.5 rust crate and npm package. I tagged for go, but I got some errors trying to update local files. I will try again for that. There was a solution in #35 but I just get errors. |
Seems to work for me with both I would just remove that one (e.g., https://github.com/confio/ics23/blob/master/go.mod and corresponding |
Yes, it is confusing, and Zaki helped with the Go tagging. I can gladly remove the top level go.mod. For some reason I thought it was needed. |
BTW, if you need this in a build of the cosmos sdk, you need to manually update the dependency. And if you want it on the hub, maybe make a PR to bump the ics23 version, so it will be included in the next release |
See discussion in cosmos/ibc#554.