We Built UltrafastSecp256k1 Up to 51% Faster ECC Across x86,ARM64,and RISC-V
2 points
1 hour ago
| 0 comments
Hey HN,We started a project on Feb 11th aiming to build the fastest, most robust secp256k1 library out there, leveraging modern CPU features and low-level assembly. It's called UltrafastSecp256k1, and after just 11 days, we've achieved some pretty aggressive benchmarks and platform coverage.The Problem We're Solving: Existing secp256k1 implementations (like libsecp256k1 from Bitcoin Core) are highly optimized, but often leave performance on the table for specific, newer hardware features or cross-platform needs. We saw an opportunity to push this further, particularly in constant-time operations and diverse architectures.What We've Done (The "How"):Deep Assembly & Hardware Intrinsics: Hand-tuned $5 \times 52$ field representation for x86-64 and ARM64. This directly bypasses higher-level abstractions to hit peak performance.Constant-Time by Design: Every critical path is designed to be constant-time, mitigating side-channel attacks. We even achieved a +51% speedup on $k \times G$ (generator scalar multiplication) for x86-64 in constant-time, compared to libsecp256k1's standard implementation.Cross-Platform & Embedded: We've expanded support rapidly: from x86/ARM64 (including Android) to ESP32-S3, and we're starting RISC-V (Milk-V Mars) next.Broad Language Bindings: The library is accessible from 12+ languages (Rust, Go, Python, Swift, Dart, Java/Kotlin, Node.js via NPM, C# via NuGet, etc.), making it easy to integrate into almost any project.Why we're sharing: We've seen over 5,000 clones in 11 days, and the project is rapidly evolving. We're looking for feedback from the HN community on our low-level optimizations, especially the constant-time implementation details and platform-specific assembly.Relevant Benchmarks: (შეგიძლია მოგვიანებით ჩასვა კონკრეტული რიცხვები, როცა განაახლებ)x86-64 ($k \times G$ CT): Ultrafast: 10.4µs vs libsecp: 15.7µs (+51% faster)ARM64 ($field\_mul$): Ultrafast: 0.083µs vs libsecp: 0.098µs (+18% faster)ARM64 ($field\_inv$): Ultrafast: 4.47µs vs libsecp: 5.21µs (+17% faster)We believe that UltrafastSecp256k1 can become a critical component for high-performance cryptographic needs in various applications, from blockchain nodes to secure IoT devices.GitHub Repo: https://github.com/shrec/UltrafastSecp256k1Changelog: https://github.com/shrec/UltrafastSecp256k1/blob/main/CHANGELOG.mdLooking forward to your insights and constructive criticism!No one has commented on this post.