[Cryptography] Native Ruby secp256k1 implementation & w/supporting review on associated risks

Simon Bettison simon at bettison.org
Wed Apr 29 10:44:47 EDT 2026


As a software engineer whose day-to-day work is in application security, I recently needed robust secp256k1 support for a Ruby SDK that I am developing:https://github.com/sgbett/bsv-ruby-sdk. 

Rather than wrapping bitcoin-core/secp256k1 I implemented the required primitives natively in Ruby, then extracted the core cryptographic operations to C for performance and auditability. The current implementation is at:

https://github.com/sgbett/secp256k1-native

It passes the full Wycheproof test vectors and replicates the same interface as the OpenSSL-based reference.

I am aware this is not the conventional path; the goal is to understand the trade-offs at a deeper level. To that end I have written a paper that explores relevant literature:

https://doi.org/10.13140/RG.2.2.25788.60802

Comments and criticism are welcome.

What I have gathered so far is that by focus was on functional equivalence, and my lack of experience blinded me to the cryptographic rigour that might be expected in this kind of work.
I would value any feedback from the list on issues that I should be prioritising or alternative approaches.

Simon


More information about the cryptography mailing list