paulmillr / noble-secp256k1

Fastest 4KB JS implementation of secp256k1 signatures and ECDH
https://paulmillr.com/noble
MIT License
757 stars 114 forks source link

Is it possible to use sha3_256 for secp256k1 #117

Closed 0xmigo closed 12 months ago

0xmigo commented 12 months ago

Hi,

In the example, I see that we are signing the sha256 of the message. Is it possible to use sha3_256 instead?

I tried using sha3_256 to hash the message, then verify, it does not work. But sha256 works though.

Wonder if you can provide an example on how to use sha3_256 instead of sha256?

Thank you so much!

paulmillr commented 12 months ago

The hash function does not matter: you simply pass a hash. An example of a custom hash function (keccak) can be seen in package https://github.com/paulmillr/micro-eth-signer

0xmigo commented 12 months ago

Got it fixed. Thank you so much @paulmillr