Bach's algorithm explained

Bach's algorithm is a probabilistic polynomial time algorithm for generating random numbers along with their factorizations. It was published by Eric Bach in 1988. No algorithm is known that efficiently factors random numbers, so the straightforward method, namely generating a random number and then factoring it, is impractical.[1]

The algorithm performs, in expectation, O(log n) primality tests. A simpler, but less efficient algorithm (performing, in expectation,

O(log2n)

primality tests), is due to Adam Kalai.[2] [3]

Bach's algorithm may be used as part of certain methods for key generation in cryptography.[4]

Overview

Bach's algorithm produces a number

x

uniformly at random in the range

N/2<x\leN

(for a given input

N

), along with its factorization. It does this by picking a prime number

p

and an exponent

a

such that

pa\leN

, according to a certain distribution. The algorithm then recursively generates a number

y

in the range

M/2<y\leM

, where

M=N/pa

, along with the factorization of

y

. It then sets

x=pay

, and appends

pa

to the factorization of

y

to produce the factorization of

x

. This gives

x

with logarithmic distribution over the desired range; rejection sampling is then used to get a uniform distribution.[1] [5]

Further reading

Notes and References

  1. Bach . Eric . Eric Bach . 10.1137/0217012 . 2 . . 935336 . 179–193 . How to generate factored random numbers . 17 . 1988.
  2. Kalai . Adam . 10.1007/s00145-003-0051-5 . 4 . . 2002046 . 287–289 . Generating random factored numbers, easily . 16 . 2003. 17271671 . free .
  3. Book: Shoup . Victor . A Computational Introduction to Number Theory and Algebra . 2008 . Cambridge University Press . Cambridge, UK . 305 . Version 2.
  4. Book: Delfs . Hans . Knebl . Helmut . Introduction to Cryptography: Principles and Applications . 2015 . Springer Verlag . Berlin . 226 . 3rd.
  5. Book: Prime Suspects: The Anatomy of Integers and Permutations. Andrew. Granville. Jennifer. Granville. Princeton University Press. 2019. 9780691188737. Constructing integers with the probabilistic model. 207–208. https://books.google.com/books?id=uPaKDwAAQBAJ&pg=PA207.