Add SHA-3 support#1680
Conversation
Added sha3_256 and sha3_512 from noble hashes
larabr
left a comment
There was a problem hiding this comment.
Thanks for working on this! 🙂
I just left a small comment about leveraging NodeCrypto as well.
I've added tests but I'm not sure if I should add more tests using a PGP key which uses SHA3 internally. What do you think? If you think that I should, where do you think I should add that test?
I would add a test checking that
- a key using SHA3 internal signatures can be read using
openpgp.readKey(e.g. key from #1663 (comment) ) - signing with the key (using
openpgp.sign) generates a sha3 signature - the newly generated SHA3 signature is verified (by
openpgp.verify)
This could go under the unit tests for signing in test/general/openpgpjs.js.
Since SHA3 is just another hash algo, I don't think more ad-hoc tests are needed: everything is expected to work as long as the underlying hash function is correct.
|
Sounds great, thanks for your quick review!! I'll add the test(s) you suggested. |
…s SHA3-512 for its internal signatures
|
Hi, I've added tests for |
Co-authored-by: larabr <[email protected]>
Co-authored-by: larabr <[email protected]>
Co-authored-by: larabr <[email protected]>
Co-authored-by: larabr <[email protected]>
|
Thanks a bunch for your feedback, explanations, and patience. :) |
There was a problem hiding this comment.
Thanks for the prompt changes! Almost there, just noted a couple of minor things 🙂 (in particular, see #1680 (comment) ).
Co-authored-by: larabr <[email protected]>
Co-authored-by: larabr <[email protected]>
Co-authored-by: larabr <[email protected]>
twiss
left a comment
There was a problem hiding this comment.
Thanks for working on this! It looks good to me. Just as a note, we may want to consider adding these algorithms to the preferred hash algorithms (in key/factory.js) as well, but before we do that we should do some benchmarks on which algorithms are fastest, to decide the order. So IMO we can merge this as-is and do that later :)
To support parsing, signing and verifying SHA3 signatures over messages and keys.
To support parsing, signing and verifying SHA3 signatures over messages and keys.
To support parsing, signing and verifying SHA3 signatures over messages and keys.
These changes should add SHA-3 support from noble hashes as I discussed with @twiss on Gitter. This change is in regards to #1663.
I've added tests in test/crypto/hash/sha.js, but I'm not sure if I should add more tests using a PGP key which uses SHA3 internally. What do you think? If you think that I should, where do you think I should add that test? Maybe test/crypto/validate.js?