How to do addition in Montgomery form?

cn flag

I'm trying to do ECDSA signing, and I need to compute

$$\left(k^{-1} \bmod n \cdot (m + d\cdot r) \bmod n\right) \bmod n$$

I'm able to do the inverse function and multiplication in Montgomery form, but how should I add $m$? Does the arithmetic play well if I just converted $m$ to Montgomery form? Alternatively, I could do $m + d\cdot r$ in 512-bit, but things would get quite messy and slow.

Any other fast ways to do this?

kelalaka avatar
in flag
Do you need the Montgomery Residue after the computation or you will turn back to the normal residue?
ng flag

Addition in Montgomery form is modular addition.

Both operands of addition, and result, are in Montgomery form.


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.