Skip to main content
  • 249 Accesses

Related Concepts

Modular Reduction; Montgomery’s Algorithm; RSA

Definition

Barrett’s algorithm is a process allowing the computation of the quantity \(u {\rm mod}\,\,n\) without resorting to trial division. The method is efficient in settings where u changes frequently for a relatively invariant n (which is the case in cryptography). Let N denote the size of n in bits, \(u < {2}^{2N}\) and \(q = \lfloor u/n\rfloor \). Define:

$$q' = \left \lfloor \frac{\left \lfloor \frac{u} {{2}^{N-1}} \right \rfloor \left \lfloor \frac{{2}^{2N}} {n} \right \rfloor } {{2}^{N+1}} \right \rfloor $$

Note that the constant \(\left \lfloor \frac{{2}^{2N}} {n} \right \rfloor \) can be computed once for all and reused for many different u values. All other operations necessary for the computation of q′ are simple multiplications and bit-shifts.

It is easy to prove that \(u - nq' < u - n(q + 2) = (u {\rm mod}\,\,n) + 2n\). Hence, one multiplication and (at most) two subtractions will suffice to determine \(u...

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 799.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Hardcover Book
USD 949.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Recommended Reading

  1. Barrett PD (1987) Implementing the Rivest Shamir and Adleman public key encryption algorithm on a standard digital signal processor. In: Odlyzko AM (ed) Advances in Cryptology. Proc. Crypto 86, LNCS 263. Springer, Berlin, Heidelberg, pp 311–323

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2011 Springer Science+Business Media, LLC

About this entry

Cite this entry

Naccache, D. (2011). Barrett’s Algorithm. In: van Tilborg, H.C.A., Jajodia, S. (eds) Encyclopedia of Cryptography and Security. Springer, Boston, MA. https://doi.org/10.1007/978-1-4419-5906-5_501

Download citation

Publish with us

Policies and ethics