Example implementation of algorithm from Section 1.1 (page 3) of Gentry's PhD thesis