Good day,I have heard about the Montgomery modular multiplication, and the Barrett_reduction; (or any other) But in practice I don't understand how could I implement a multiplication algorithm in a Ring modulo n.I am looking for such algorithm in an JavaScript environment using an accumulator.Edit: I found what I was looking for:To multiply A x B mod M: (Ai being each digits of A from left to right)acc <- B * A0i<-1While i <= A.length-1 do   acc <- (acc * 10 + B * Ai)   while acc>= M do acc-= M end   i++EndReturn acc
How to compute multiplication in $ \mathbb{Z} / n\mathbb{Z} $?
algorithms;multiplication;modular arithmetic