keyword encryption challenge of python

chinggltc

Estimable
Jan 24, 2016
1
0
4,510
0
Hey can anyone help me to solve this question ? I've been doing this for a month but still can't find any solution
A more secure method of encryption would be to use a keyword. A keyword is the information needed in order to transform the plaintext into the encrypted message and is also used by the recipient to decrypt the message. For example, a keyword could be the letters GCSE. The keyword is repeated enough times to match the length of the plaintext message. The alphabet value (position of the letter in the alphabet) of each letter of the key phrase is added to the alphabet value of each letter of the plaintext message to generate the encrypted text.
For example, if we use the keyword GCSE then we make up the key phrase for COMPUTINGISFUN by repeating the letters within GCSE to make a 14 letter code, GCSEGCSEGCSEGC, where G is the 7th letter of the alphabet, C the 3rd, S the 19th and E the 5th.

here's my code
x=input("Please enter your keyword: ")
y=input("Please enter your message: ")


def keyword(x,y):
letter=' ABCDEFGHIJKLMNOPQRSTUVWXYZ'
if x.isupper():
for c in x:
x=letter.index(c)
if y.isupper():
for c in y:
y=letter.index(c)
z= x + y
print(z)
else:
print("lower case letter not available")

else:
print("lower case letter not available")

keyword(x,y)
 
Thread starter Similar threads Forum Replies Date
C Apps General Discussion 4
F Apps General Discussion 3
M Apps General Discussion 3
M Apps General Discussion 1
S Apps General Discussion 3
G Apps General Discussion 2
pranav.appu.472 Apps General Discussion 1
Pimpom Apps General Discussion 5
W Apps General Discussion 8
A Apps General Discussion 1
T Apps General Discussion 1
T Apps General Discussion 3
T Apps General Discussion 2
B Apps General Discussion 1
Hastibe Apps General Discussion 11
R Apps General Discussion 1
computaur Apps General Discussion 3
P Apps General Discussion 4
ipwn3r456 Apps General Discussion 2
rocknrollz Apps General Discussion 4

ASK THE COMMUNITY

TRENDING THREADS