Source: https://user.eng.umd.edu/~danadach/Cryptography_23/lec_1_23_notes.pdf