Research Article

Revisiting Sum of Residues Modular Multiplication

Algorithm 2

Improved Barrett modular multiplication.
Require: 𝛼 , 𝛽 { P r e - d e n e d p a r a m e t e r s }
Require: 𝐾 = 2 𝑛 + 𝛼 / 𝑀 { A p r e c o m p u t e d c o n s t a n t }
Ensure: 𝐶 𝐴 × 𝐵 m o d 𝑀
𝐶 = 𝐴 × 𝐵
𝐶 1 = 𝐶 / 2 𝑛 + 𝛽 { R i g h t s h i f t b y 𝑛 + 𝛽 }
𝐶 2 = 𝐶 1 × 𝐾
𝑄 = 𝐶 / 2 𝛼 𝛽
𝐶 = 𝐶 𝑄 × 𝑀