Hey everyone,
I’m kinda new to cryptography and have been tinkering with ECC. Managed to code BSGS and kangaroo algorithms in Rust, but using the k256 crate has been kinda slow in comparison to libraries like keyhunt and cyclone.
From my testing, creating public keys takes way longer than doing sha256 or ripemd160. Looks like I need to get into optimizing the core ECC operations.
Check out libsecp256k1, best bet for fast public key generation from private keys.
Seriously, avoid deriving them from private keys directly. Precompute any public keys that are fixed, and do your calculations in affine coords. If you have a bunch of (pubA, pubB) pairs, do it all in one go with a shared field inverse.
The secp256k1 API isn't really low-level, those wrappers are probably not gonna cut it for raw performance.
You need to expose certain functions to avoid unnecessary internal conversions, like the one from 64 bytes pubKey to a 5x52 representation. Best to write those low-level operations in C; anything else will just slow you down.