-
Notifications
You must be signed in to change notification settings - Fork 0
/
hide.py
36 lines (25 loc) · 904 Bytes
/
hide.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# A code to recieve a uppercase and hide it's meaning then print back
# the character
# Enter a string to hide in uppercase : HIDE
# Secret Message :
# original message : HIDE
# Input "Enter a string to hide in uppercase"
secret = input('enter an upper case password: ')
print()
secret_string = ''
# Cycle through each character in the string
for char in secret:
# Store each character code in a new string
secret_string += str(ord(char) - 23)
# Print Secret message
print('Secret message :', secret_string)
print()
# Cycle through each character in the string
secret = ''
for i in range(0, len(secret_string)-1, 2):
# Get the 1st and 2nd for the 2 digit numbers
char_code = secret_string[i] + secret_string[i+1]
# Convert the code into characters and add them to a new string
secret += chr(int(char_code) + 23)
# Print original Message
print('Original message :', secret)