StableLib / stablelib

A stable library of useful TypeScript/JavaScript code
https://www.stablelib.com
Other
175 stars 36 forks source link

Add xchacha20 and XChacha20Poly1305 #12

Closed kdenhartog closed 5 years ago

kdenhartog commented 5 years ago

XChacha20 module appears to be good and has passing tests. Would you mind giving it a review?

Additionally, I'm working through the XChacha20Poly1305 implementation based on draft-arciszewski-xchacha-03, but have encountered some problems based on the suggested method of implementation in the RFC. Specifically in section 2, it says to generate the subkey using the Hchacha method and then to generate the nonce, which I've tried. However, it doesn't specify which of the APIs should be used which is what I'm working through now.

I'd appreciate some feedback on this work in order to get the test passing which comes from the RFC as well as any feedback about code style would be appreciated as well.

Thanks

kdenhartog commented 5 years ago

If it would be easier for you to review, I can split this into two individual PRs. One for the XChacha20 cipher work, and then a separate one for the XChacha20Poly1305 work which is still in progress.

kdenhartog commented 5 years ago

Got the tests passing for this PR and cleaned up the commit log so it's easier to review based on the specific packages.

dchest commented 5 years ago

Thank you! Will review on Thursday.

kdenhartog commented 5 years ago

Thanks for the review. I also noticed that for some reason the CI pipeline was failing to import ChaCha20Poly1305 into the XChaCha20Poly1305 module. I wonder if it's because of the modifications I made around lerna.

kdenhartog commented 5 years ago

Everything should be working now. I had noticed that the benchmarking was broken when I was seeing the speed of operations and fixed it. I've squashed all the commits for the comments and the fixes for benchmarking together into commit b96e05e

dchest commented 5 years ago

Thank you, merged! I'll tweak the build process and then release it.