Source: https://www.math.u-bordeaux.fr/~gcastagn/Cryptanalyse/sage_pres.pdf