Source: https://www.palomar.edu/math/wp-content/uploads/sites/134/2018/09/Cryptography-Lecture.pdf