README ΒΆ Introduction Modular exponentiation is a time-consuming operation, and this project has performed a Golang benchmark test on three different implementations. Method Note Is Constant-Time Run Time (Small Parameter) Run Time (Big Parameter) ModExp Use Golang builtin big package No π’ 17532 ns π 2281780 ns ModExpGo3rdParty Use cronokirby/saferith package Yes π 28941 ns π’ 6000609 ns π’ ModExpOpenSSL Use OpenSSL (BN_mod_exp_mont_consttime) Yes π 20389 ns 1325081 ns π Constant-time is important for security because it prevents attackers from using timing analysis to deduce sensitive information about the input data Test CPU: Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz Small Parameter: 256 bits base/96 bits exponent/256 bits modulus Big Parameter: 2048 bits base/768 bits exponent/2048 bits modulus Conclusion If you are using it in a cryptography scenario, please choose ModExpGo3rdParty or ModExpOpenSSL. If you are using it in a cryptography scenario and performance is a major concern, please choose ModExpOpenSSL. Test $ go test -bench . goos: darwin goarch: amd64 pkg: github.com/10gic/modular-exponentiation-benchmark cpu: Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz BenchmarkModExp256-8 69508 17532 ns/op BenchmarkModExpGo3rdParty256-8 41390 28941 ns/op BenchmarkModExpOpenSSL256-8 58264 20389 ns/op BenchmarkModExp2048-8 520 2281780 ns/op BenchmarkModExpGo3rdParty2048-8 199 6000609 ns/op BenchmarkModExpOpenSSL2048-8 904 1325081 ns/op PASS ok github.com/10gic/modular-exponentiation-benchmark 9.169s Expand βΎ Collapse β΄ Documentation ΒΆ There is no documentation for this package. Source Files ΒΆ View all Source files main.go Click to show internal directories. Click to hide internal directories.