Source: https://www.labri.fr/perso/anlentz/Teaching/L2_AES/TD3.pdf