I made this last year when I was 14 :3 We were studying one time pads in math so i made this. ez A+ eva
Source
from array import array
import math
import time
import sys
#---Asking for encrypt or decrypt---#
print("What you like to do encrypt or decrypt a message?")
QES1 = input ("")
if 'decrypt' in QES1 or 'Decrypt' in QES1 or 'de' in QES1:
#---Asking for encrypted message---#
#---D = decrypt---#
print("What is the message you would like to decrypt? (All capitals please)")
Encrypttext = input ("")
#---Turning Message into a list---#
EncrypttextList = list(Encrypttext)
print(EncrypttextList)
#---Turning Letters into numbers---#
print ("Turning letters into numbers")
time.sleep(2)
EncrypttextNumber = [ord(x) for x in list(Encrypttext)]
print (EncrypttextNumber)
#---Asking for the one time pad---#
print("What is the 'One-Time-Pad'/Encryption that was used? (Please make sure it's as long as your actual Message and in capitals)")
DOTPText = input ("")
#---Turning OTP into a list---#
DOTPtextList = list(DOTPText)
print(DOTPtextList)
#---Turning Letters into numbers---#
print ("Turning OTP letters into numbers")
time.sleep(2)
DOTPtextNumber = [ord(x) for x in list(DOTPText)]
print (DOTPtextNumber)
#---Adding the OTP and Plain text---#
print ("subtracting the OTP and Plain text")
DMod26 = [a - b for a, b in zip(EncrypttextNumber,DOTPtextNumber)]
time.sleep(2)
print (DMod26)
#---Mod 26'ing the sum of OTP and Plain text---#
print ("Mod 26'ing the sum of OTP and Plain text")
DCipher = [y%26 for y in list(DMod26)]
time.sleep(2)
print (DCipher)
#---Turning OTP characters---#
DCipherWords64 = [y+64 for y in list(DCipher)]
DCipherWord = [chr(x) for x in list(DCipherWords64)]
time.sleep(2)
print("This is your original text")
print(DCipherWord)
time.sleep(10)
#---Shuts down progarm---#
sys.exit()
#---Asking for message---#
print("What is the message you would like to encrypt? (All capitals please)")
Plaintext = input ("")
#---Turning Message into a list---#
PlaintextList = list(Plaintext)
print(PlaintextList)
#---Turning Letters into numbers---#
print ("Turning letters into numbers")
time.sleep(2)
PlaintextNumber = [ord(x) for x in list(Plaintext)]
print (PlaintextNumber)
#---Making letters the right numbers---#
print ("Giving letters the correct value to work with a 'One-Time-Pad'")
time.sleep(2)
Plaintext64 = [y-64 for y in list(PlaintextNumber)]
print (Plaintext64)
#---Asking for the one time pad---#
print("What is the 'One-Time-Pad'/Encryption you would like to use? (Please make sure it's as long as your actual Message and in capitals)")
OTPText = input ("")
#---Turning OTP into a list---#
OTPtextList = list(OTPText)
print(OTPtextList)
#---Turning Letters into numbers---#
print ("Turning OTP letters into numbers")
time.sleep(2)
OTPtextNumber = [ord(x) for x in list(OTPText)]
print (OTPtextNumber)
#---Making letters the right numbers---#
print ("Giving OTP letters the correct value to work with a 'One-Time-Pad'")
time.sleep(2)
OTPtext64 = [y-64 for y in list(OTPtextNumber)]
print (OTPtext64)
#---Adding the OTP and Plain text---#
print ("Adding the OTP and Plain text")
Mod26 = [sum(i) for i in zip(OTPtext64,Plaintext64)]
time.sleep(2)
print (Mod26)
#---Mod 26'ing the sum of OTP and Plain text---#
print ("Mod 26'ing the sum of OTP and Plain text")
Cipher = [y%26 for y in list(Mod26)]
time.sleep(2)
print (Cipher)
#---Turning OTP characters---#
CipherWords64 = [y+64 for y in list(Cipher)]
CipherWord = [chr(x) for x in list(CipherWords64)]
time.sleep(2)
print("This is your ciphered text")
print(CipherWord)
time.sleep(10)
#---Shuts down progarm---#
sys.exit()