Source: https://www.emse.fr/~dutertre/documents/math_crypto.pdf