Created
February 9, 2024 10:14
-
-
Save gousiosg/ff1be1ca01a31d938b238ffa2193c829 to your computer and use it in GitHub Desktop.
Encryption / Decryption for kinds experiments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# (c) 2019 Georgios Gousios <[email protected]> | |
# | |
# Teaching encryption to kids | |
import sys | |
from encryption import KEY | |
INVERTED_KEY = {value: key for key, value in KEY.items()} | |
print(INVERTED_KEY) | |
while True: | |
try: | |
for line in sys.stdin: | |
for c in line: | |
if c in INVERTED_KEY.keys(): | |
sys.stdout.write(INVERTED_KEY[c]) | |
else: | |
sys.stdout.write(c) | |
except KeyboardInterrupt: | |
print() | |
exit(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# (c) 2019 Georgios Gousios <[email protected]> | |
# | |
# Teaching encryption to kids | |
import sys | |
KEY = { | |
'a': '๐', | |
'b': '๐ฉ', | |
'c': '๐ท', | |
'd': '๐', | |
'e': '๐', | |
'f': '๐ญ', | |
'g': '๐', | |
'h': '๐น', | |
'i': '๐ฅ', | |
'j': '๐', | |
'k': '๐', | |
'l': '๐ฎ', | |
'm': '๐', | |
'n': '๐ฑ', | |
'o': 'โ', | |
'p': '๐ ', | |
'q': '๐', | |
'r': '๐ณ๏ธโ๐', | |
's': '๐ฎ๐ด', | |
't': '๐ฌ๐ท', | |
'u': '๐ต๐ท', | |
'v': '๐ณ๐ฑ', | |
'w': '๐บ๐ธ', | |
'x': '๐ฌ๐ง', | |
'y': '๐ฟ๐ผ', | |
'z': '๐น๐ท', | |
'A': '๐ณ', | |
'B': '๐ฅฆ', | |
'C': '๐ฅ', | |
'D': '๐ก', | |
'E': '๐', | |
'F': '๐ป', | |
'G': '๐ฒ', | |
'H': '๐', | |
'I': '๐ฟ', | |
'J': '๐พ', | |
'K': '๐ฆ', | |
'L': '๐ง', | |
'M': '๐ฆ', | |
'N': '๐ด', | |
'O': '๐ธ', | |
'P': 'โพ', | |
'Q': 'โ', | |
'R': 'โ', | |
'S': 'โฏ', | |
'T': 'โง', | |
'U': '๐ช๐ธ', | |
'V': '๐ซ๐ฒ', | |
'W': '๐ณ๐ฎ', | |
'X': '๐ด', | |
'Y': 'โช๏ธ', | |
'Z': '๐ต', | |
'0': '๐ค', | |
'1': '๐ธ', | |
'2': '๐ฌ', | |
'3': '๐', | |
'4': '๐', | |
'5': '๐ ', | |
'6': 'โ๏ธ', | |
'7': '6๏ธโฃ', | |
'8': '๐', | |
'9': '4๏ธโฃ', | |
} | |
while True: | |
try: | |
for line in sys.stdin: | |
for c in line: | |
if c in KEY.keys(): | |
sys.stdout.write(KEY[c]) | |
else: | |
sys.stdout.write(c) | |
except KeyboardInterrupt: | |
print() | |
exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment