![]() Print(RSA('python')) # encrypts and decrypts message 'python' # find two prime numbers whose product n will be greater than m Choose two distinct prime numbers p and q. # requires an int m that is an int representation (in ascii) of our message # each character in the message is converted to a ascii decimal value The function RSA takes a string and encodes it as an ASCII integer, creates public and private keys for decryption, encrypts the encoded integer using the public keys, decrypts it using the private key, and then decodes the integer back into a string: import math I translated the plain English algorithm from the Key Generation section of the Wikipedia article. ![]() Read the Wikipedia page on the RSA algorithm3 and write functions to encode and decode messages. ![]() Downey, prompts the following:Įxponentiation of large integers is the basis of common algorithms for public-key encryption. Exercise 11.7 from Chapter 11 of Think Python, by Allen B.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |