Post
Topic
Board Development & Technical Discussion
Topic OP
Fast ECC operations on the secp256k1 curve using rust?
by
invisibleecho
on 06/03/2025, 20:07:53 UTC
Hey guys,

I've been relatively new to the cryptography space and read many things about ECC and coded BSGS and kangaroo successfully in rust.
However, since im using the k256 crate, performance is not really there (compared to keyhunt or cyclone).
According to my tests, sha256 and ripemd160 are less intense than the creation of the public keys (or the affine points on the secp256k1 curve to be specific).

So I think I need to optimize the core ECC operations. What I know is that:
- Affine points are the (X,Y) coordinates on the actual curve
- Projective points (X,Y,Z=1) additions are computational cheaper than affine point addition / multiplication
- Using some batched inversion at an amortized cost to convert affine points to projective points helps increasing performance

However, even when keeping at this in mind, I roughly generate 2MKeys/thread using k256 and using 12 threads basically results in around 12MKeys/s - so I thought are there more algorithms which could be used along with k256 or do I need another library to generate those points quicker?

I read that many cpp implementations use the base of jean-luc pons, but I don't really understand what's going on there. The only thing I see is that he basically precomputes G points from 0..255 (+ and -) but I'm not really sure about the math behind it - but it seems to be faster because keyhunt (which uses his implementations) runs at 35Mkeys/s on 12 threads and 5Mkeys/s on 1 thread (normal bruteforce).

BTW: When I talk about Mkeys/s, I literally mean million points per second (no bsgs or whatever) - just to messure how many public points I can create in a second.

Any ideas, libraries, tutorials or whatever would be appreciated!

cheers