![]() If n % e != 0: #checks if integer is divisible by nįactor = False #if remainder is not 0, the integer isn't divisible by n. If n % 2 != 0: #checks if integer is divisible by 2įor x in range(3, int(n ** 0.5), 2): #starts at 3, increments by 2 to check if integer is divisible by anythingīreak #if integer divides a number x and has no remainder, it isn't prime and the loop breaksĮ = random.randint(3, 35) #creates random integer from 2 to p(n), but keeps it small for ease of use How can I change that number into a character and still be able to decrypt it using my private key later? Here is my rough code so far: import random However, the number I get back is far out of range to change back into an ASCII character. I take the ASCII ordinance of each character and encrypt using my e and n. The problem I run into is trying to encrypt it. So I get my p, q, n, phi, e, and d and everything is fine. The professor is having us make an RSA encryption/decryption program without using the crypto libraries (all done from scratch). I am doing a project for one of my classes.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |