diff options
| author | Frank Denis <124872+jedisct1@users.noreply.github.com> | 2023-10-21 11:09:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-21 02:09:43 -0700 |
| commit | a5c79c79983739630d7269f8583525d83ba9677b (patch) | |
| tree | a1e29fca84b608a66f96fce1feb7d764e308a43a /src/codegen/spirv/Module.zig | |
| parent | 54a4f24ea7c76297e97683501aef607b2a27cd16 (diff) | |
| download | zig-a5c79c79983739630d7269f8583525d83ba9677b.tar.gz zig-a5c79c79983739630d7269f8583525d83ba9677b.zip | |
crypto.ff: faster exponentiation with short/public exponents (#17617)
RSA exponents are typically 3 or 65537, and public.
For those, we don't need to use conditional moves on the exponent,
and precomputing a lookup table is not worth it. So, save a few
cpu cycles and some memory for that common case.
For safety, make `powWithEncodedExponent()` constant-time by default,
and introduce a `powWithEncodedPublicExponent()` function for exponents
that are assumed to be public.
With `powWithEncodedPublicExponent()`, short (<= 36 bits) exponents
will take the fast path.
Diffstat (limited to 'src/codegen/spirv/Module.zig')
0 files changed, 0 insertions, 0 deletions
