Hey guys,
Today i will show you how you can make a program which will Encrypt and Decrypt the text entered by the user..
I,m using 3.8.2 python version, You can use this code in other versions too.
This is the program:
mes = input("Enter the messege:\n") #Here you are taking input from user.
alph = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_=+[{]}\|;:,.<>?/" #In this step i added all alphabets and characters to index the user input..
enc = "" #Encrypted text will send to this variable.
dec = ""
for i in mes:
f = alph.find(i) #this will find the index number of input from all alph.
t = (f + 33) % 90 #here new variable t add + 33 in the input index number and total alph is 90 thats why 90 is used,
enc += alph[t] # this will take data from t and and send to enc..
print("Encrypted is",enc)
for i in enc:
j = alph.find(i)
l = (j - 33) % 90 #opposite of input
dec += alph[l]
print("Decrypted is",dec)
Now, check the program..
Today i will show you how you can make a program which will Encrypt and Decrypt the text entered by the user..
I,m using 3.8.2 python version, You can use this code in other versions too.
This is the program:
mes = input("Enter the messege:\n") #Here you are taking input from user.
alph = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_=+[{]}\|;:,.<>?/" #In this step i added all alphabets and characters to index the user input..
enc = "" #Encrypted text will send to this variable.
dec = ""
for i in mes:
f = alph.find(i) #this will find the index number of input from all alph.
t = (f + 33) % 90 #here new variable t add + 33 in the input index number and total alph is 90 thats why 90 is used,
enc += alph[t] # this will take data from t and and send to enc..
print("Encrypted is",enc)
for i in enc:
j = alph.find(i)
l = (j - 33) % 90 #opposite of input
dec += alph[l]
print("Decrypted is",dec)
Now, check the program..
0 Comments