CoCalc Public FilesRSA Encryption.sagewsOpen with one click!
Authors: Liljana Babinkostova, William Unger
Views : 82
Compute Environment: Ubuntu 20.04 (Default)
def ASCIIPad(Message): newList = [] messLen = len(Message) tempIter = messLen - 1 while tempIter >= 0: newList.append(Message[tempIter]) tempIter -= 1 x = [100+ord(newList[i]) for i in range(messLen)]; x = ZZ(x,1000); return(x);
def rsaencrypt(Message, encrexp, encrmod): A = ASCIIPad(Message); E = power_mod(A,encrexp,encrmod); return(E);
p = next_prime(861786187687436287634876534289765348257634287956239487652349785634875634875); q = next_prime(7345678659826873465873492654392856349285734342875687689734569384275698374563847956349875);
N = p*q; e = 101; M="Crypto is used everywhere."; m=ASCIIPad(M); E = rsaencrypt(M,e,N); print(E);
979153975075107784281799842594898949688234055468244298885509654151181066422087535039031049660169647247652878439563659738124018482375543000035994478937003968901276