Source: https://alexis-bonnecaze.pedaweb.univ-amu.fr/Crypto3/Crypto3.pdf