Skip to main content
. 2019 Jun 27;19(13):2864. doi: 10.3390/s19132864
Algorithm 2: Montgomery Multiplication
Input: P¯=P×rmodN and Q¯=Q×rmodN where r=2n and n=⌈log2N⌉
Output: R¯=P×Q×rmodN
S←P¯×Q¯
W←S×N′modr where N′=N−1modr
T←(S+W×N)/r
if T≥N then((
|   T=T−N
end
(
R←T
Return (R¯)