Skip to content

Use bounded exponentiation to improve encrypt/verify performance#662

Open
lubux wants to merge 1 commit intoRustCrypto:masterfrom
lubux:feat/improve-encrypt-performance
Open

Use bounded exponentiation to improve encrypt/verify performance#662
lubux wants to merge 1 commit intoRustCrypto:masterfrom
lubux:feat/improve-encrypt-performance

Conversation

@lubux
Copy link

@lubux lubux commented Feb 25, 2026

Limit exponentiation to the bit length of e to reduce computation time.
This is safe since e is public.

Improves encrypt/verify performance by over 2x on my laptop.

rsa_2048_pkcsv1_encrypt time:   [17.822 µs 17.849 µs 17.877 µs]
                        change: [-80.899% -80.786% -80.697%] (p = 0.00 < 0.05)
                        Performance has improved.
rsa_4096_pkcsv1_encrypt time:   [149.74 µs 150.04 µs 150.37 µs]
                        change: [-63.132% -61.496% -60.140%] (p = 0.00 < 0.05)
                        Performance has improved.
                        
                        
aws_lc_rs_2048_pkcs1_encrypt
                        time:   [10.682 µs 10.714 µs 10.747 µs]
aws_lc_rs_4096_pkcs1_encrypt
                        time:   [31.771 µs 31.826 µs 31.879 µs]

Limit exponentiation to the bit length of e to reduce computation time.
This is safe since e is public.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant