I want to perform a modular reduction using Solinas prime value as q = 2^383-2^33+1. How can I efficiently compute it taking advantage of q being Solinas prime?


1 Answer 1


The rough idea is:

  1. start with the highest non-zero word,
  2. multiply each non-zero term in the Solinas number (for example, -1 at 33'rd bit and 1 at lowest bit)
  3. subtract the multiplied term from the number twice - the second time is to ensure any carry in the highest non-zero word is cleared.
  4. repeat the process for the next highest word until the number is less than the modulus.

I've an implementation of this you can reference, it's written for the modulus of the P-256 curve.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.