Skip to content

Instantly share code, notes, and snippets.

@gousiosg
Created February 9, 2024 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gousiosg/ff1be1ca01a31d938b238ffa2193c829 to your computer and use it in GitHub Desktop.
Save gousiosg/ff1be1ca01a31d938b238ffa2193c829 to your computer and use it in GitHub Desktop.
Encryption / Decryption for kinds experiments
#!/usr/bin/env python3
# (c) 2019 Georgios Gousios <gousiosg@gmail.com>
#
# 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)
#!/usr/bin/env python3
# (c) 2019 Georgios Gousios <gousiosg@gmail.com>
#
# 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