Last active
May 10, 2022 00:05
-
-
Save nick3499/aa82c6704c2c889f26d69540f9338583 to your computer and use it in GitHub Desktop.
Vowel Encoding: Python 3: 'vowel encoding' changes vowels to numbers in order to obfuscate context
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
#!/bin/python3 | |
'''Use encoding to disguise message by converting vowels to numbers.''' | |
# Permission granted under “The MIT License” (open source) | |
def encode(s: str) -> str: | |
enc = { 'a': '1', 'e': '2', 'i': '3', 'o': '4', 'u': '5' } | |
return ''.join(enc[x] if x in enc else x for x in s) | |
def decode(s: str) -> str: | |
dec = { '1': 'a', '2': 'e', '3': 'i', '4': 'o', '5': 'u' } | |
return ''.join(dec[x] if x in dec else x for x in s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The script could be executed locally in a Python shell using
requests.get()
: