Source: http://iml.univ-mrs.fr/~kohel/tch/L3-Crypto/TD/soln/Crypto_TD1.pdf