Source: https://www.math.u-bordeaux.fr/~gcastagn//Cryptanalyse/cours-20-21.pdf