Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
coolest symmetric encryption algorithm of 2021
#!/usr/bin/env python3
description = """
๐Ÿ‘ฝ EMOJIPHER ๐Ÿ‘ฝ
Your favorite encryption tool!
Are you bored of cryptographically safe means of encryption like AES256?
You hate asymmetric encryption?
You are a modern human that loves big hard drives and emojis?
You want to waste as much bandwith as you can?
You want to choke NSA and TENCENT servers with emoji?
If you answered any of those questions with YES, this script is for you.
Encrypt your data by turning each byte of source file into emoji! Yes, thats right.
Each byte becomes 4 bytes! And you get multiple emoji possibilities per byte!
Frequency analysis? More like waste of electricity.
Okay, I want this, but how do I start?
1. Generate your personal key by issuing. It will append .emojipher to the end of your given name.
$ ./emojipher.py -g my_key
2. Encrypt some data!
$ ./emojipher.py -e my_secrets.txt -k my_key.emojipher
3. ... Do whatever you want, store it, send it, share it ๐Ÿคก
4. Decrypt your precious data.
$ ./emojipher.py -d my_secrets.txt.encrypted -k my_key.emojipher
5. Enjoy your decrypted data, but make sure you are alone.
Made with ๐Ÿคก by the ๐Ÿคค in www.exception.lt
"""
changelog = """
๐Ÿ‘ฝ EMOJIPHER CHANGELOG ๐Ÿ‘ฝ
10.10.2020
+ made everything async, because why not. i have not checked if it made it faster/slower, but added because it is hype to do async.
+ fixed decryption making file disappear.
- removed emojipedia depedency by hardcoding emojis into the file. 5kb to 25kb file, but no pip installs needed. uses standardlib. if argparse is in standardlib.
+ decrypted message does not replace og message, it will be named <input_file>.decrypted, like you pass <message_file>.encrypted to the decryptor.
"""
from argparse import ArgumentParser, RawDescriptionHelpFormatter
# from emojipedia import (
# Emojipedia,
# ) # replace with a massive list of hardcoded emojis lol.
import asyncio
import secrets
import os.path
import ast
async def get_all_emojis() -> set:
"""You like hardcoded emoji set? Here you go ;)"""
# return set([x.character for x in Emojipedia.all() if len(str(x.character)) == 1])
return {
"๐Ÿ’†",
"๐Ÿ•",
"๐Ÿฅ",
"๐Ÿ“ฃ",
"๐Ÿฎ",
"๐Ÿˆ",
"\U0001faa2",
"๐Ÿ",
"๐Ÿฆฒ",
"๐Ÿ“ฅ",
"\U0001f9a4",
"๐Ÿ’œ",
"๐ŸŒป",
"๐Ÿ“Œ",
"๐Ÿ‹",
"๐Ÿฆฏ",
"๐Ÿ‡ฟ",
"๐Ÿญ",
"๐Ÿ“",
"๐ŸŒฐ",
"๐ŸŒ‡",
"\U000e0034",
"๐ŸŽพ",
"๐Ÿฉ",
"\U000e0072",
"๐Ÿคฆ",
"๐Ÿจ",
"๐Ÿง‰",
"๐Ÿ‡ช",
"๐ŸŽช",
"๐Ÿ›€",
"๐ŸŒ",
"๐Ÿ”—",
"๐Ÿฅข",
"๐Ÿ’€",
"\U000e005e",
"๐Ÿœ",
"๐Ÿคก",
"\U000e006a",
"๐ŸŽ ",
"๐Ÿณ",
"\U0001fa9a",
"\U000e005c",
"\U000e0049",
"๐Ÿšง",
"๐Ÿฅ‰",
"๐Ÿ‘พ",
"๐ŸŒˆ",
"\U000e004f",
"๐Ÿ‘ก",
"๐Ÿ‘‘",
"๐Ÿ”…",
"โฌ›",
"๐Ÿฅˆ",
"๐Ÿšน",
"๐Ÿš„",
"๐Ÿฅ",
"\U0001fab1",
"๐Ÿš’",
"๐Ÿ• ",
"๐Ÿ’ฏ",
"๐Ÿคฒ",
"๐Ÿง…",
"๐Ÿ’ฒ",
"๐Ÿค—",
"๐Ÿ˜บ",
"๐Ÿ‘š",
"๐Ÿ”ผ",
"๐Ÿ•œ",
"๐Ÿ†˜",
"โ˜”",
"๐Ÿ”ฆ",
"๐Ÿฐ",
"๐Ÿฅ‹",
"๐Ÿ’น",
"\U000e002a",
"๐ŸŸฆ",
"๐Ÿฑ",
"๐Ÿค",
"๐Ÿฆ–",
"๐ŸŒŠ",
"๐Ÿฅ„",
"๐Ÿ˜",
"๐Ÿ˜–",
"๐Ÿ‡",
"๐Ÿงค",
"๐Ÿ“ƒ",
"๐ŸŒ‰",
"๐Ÿ“‰",
"๐Ÿ’ ",
"๐Ÿง‘",
"๐Ÿฅค",
"๐Ÿ”ถ",
"๐Ÿฑ",
"๐Ÿ“›",
"๐Ÿ˜",
"๐ŸŒ‹",
"๐Ÿ˜ณ",
"๐ŸŽˆ",
"๐Ÿ˜„",
"๐Ÿ•",
"๐Ÿฅพ",
"โšฝ",
"๐Ÿ˜ง",
"๐Ÿ˜ž",
"\U0001fab0",
"๐Ÿจ",
"\U0001f977",
"๐Ÿฅ",
"๐Ÿ›‚",
"โ˜•",
"๐Ÿ“",
"๐Ÿ’ฃ",
"๐Ÿ” ",
"๐Ÿ”•",
"๐Ÿ””",
"๐Ÿ“”",
"\U000e0023",
"๐ŸŽ",
"๐Ÿคบ",
"๐Ÿˆด",
"๐Ÿ‘ต",
"๐Ÿง„",
"๐ŸฆŸ",
"๐ŸŽผ",
"๐Ÿš",
"๐Ÿ‘Š",
"๐Ÿ”ญ",
"๐Ÿ•ง",
"๐Ÿค–",
"๐Ÿ™Š",
"โ™",
"๐Ÿ’ป",
"\U000e003b",
"๐Ÿ›น",
"๐ŸŒ",
"\U000e0042",
"๐ŸŠ",
"\U000e0066",
"๐Ÿง—",
"\U000e0053",
"๐Ÿต",
"๐ŸŽŠ",
"๐Ÿ––",
"๐ŸงŽ",
"๐Ÿš‹",
"๐Ÿ—ฝ",
"๐Ÿ‘ข",
"๐ŸŒŒ",
"๐ŸŽน",
"๐Ÿ˜‰",
"๐Ÿคš",
"๐Ÿ‘ท",
"\U000e0031",
"๐Ÿค™",
"๐Ÿฆ",
"๐Ÿ‡ฉ",
"๐Ÿ”“",
"๐Ÿš",
"๐Ÿšœ",
"๐Ÿ˜ด",
"๐Ÿคฃ",
"\U000e002e",
"๐ŸŸ",
"\U0001f9ac",
"๐Ÿ“ต",
"๐ŸŒ",
"\U000e004a",
"\U000e0030",
"๐Ÿ‘ฌ",
"๐ŸŽŽ",
"๐Ÿ“ ",
"๐Ÿ“˜",
"๐Ÿฉธ",
"\U000e002c",
"๐Ÿ‚",
"โŒš",
"\U000e0033",
"\U000e0071",
"๐Ÿ’ถ",
"๐Ÿ™",
"๐Ÿงซ",
"๐Ÿƒ",
"๐Ÿ",
"โš“",
"๐Ÿ•Ž",
"โŒ",
"โž–",
"๐Ÿ“–",
"๐Ÿ‘ซ",
"๐ŸŒ ",
"๐Ÿ˜†",
"๐ŸคŸ",
"๐ŸŒท",
"๐ŸŸฉ",
"๐Ÿฆง",
"๐Ÿ’ˆ",
"๐Ÿฆ",
"๐Ÿด",
"๐Ÿ€„",
"๐Ÿ’ด",
"โ™“",
"๐Ÿฆบ",
"\u200d",
"๐Ÿพ",
"๐Ÿฆด",
"๐ŸŽ“",
"๐ŸŽ‰",
"๐Ÿก",
"\U000e0036",
"๐ŸฅŸ",
"๐Ÿ‘”",
"๐Ÿ‘Œ",
"๐ŸŽท",
"๐Ÿงพ",
"๐Ÿ›‘",
"๐Ÿ˜ช",
"๐Ÿ˜œ",
"\U0001fa74",
"๐Ÿ”ค",
"๐ŸŽ",
"๐Ÿ•”",
"๐Ÿ”",
"๐Ÿ“š",
"๐Ÿ•ž",
"๐Ÿ“ฑ",
"\U000e0076",
"\U000e0070",
"๐Ÿพ",
"๐Ÿ›ธ",
"๐Ÿง",
"๐Ÿฆจ",
"๐Ÿจ",
"๐Ÿธ",
"๐Ÿ“‘",
"๐Ÿก",
"\U0001faa1",
"โ—พ",
"\U0001fa98",
"๐Ÿ”",
"๐Ÿšˆ",
"๐Ÿ•Ÿ",
"๐Ÿš‘",
"๐Ÿ†“",
"\U000e0077",
"๐Ÿˆต",
"\U000e005f",
"\U000e003f",
"๐Ÿงธ",
"๐Ÿ‡ด",
"๐ŸŽป",
"๐ŸŒฏ",
"๐Ÿณ",
"\U000e004c",
"๐Ÿ’ƒ",
"๐ŸŒญ",
"๐Ÿง”",
"\U000e0057",
"๐Ÿ“ค",
"๐Ÿฆˆ",
"๐Ÿฅ",
"๐Ÿ",
"๐ŸšŒ",
"๐Ÿคฟ",
"๐Ÿง",
"๐Ÿ’ค",
"๐Ÿ˜š",
"๐Ÿ‘ˆ",
"๐Ÿง“",
"๐Ÿ‡ญ",
"๐Ÿ›",
"๐Ÿ“œ",
"๐ŸคŽ",
"๐Ÿšฟ",
"๐Ÿšฒ",
"๐Ÿ’ข",
"๐Ÿช€",
"๐Ÿ‘ƒ",
"๐Ÿ•’",
"๐Ÿฆท",
"๐Ÿฅœ",
"\U000e0064",
"๐Ÿš…",
"๐Ÿ“ฐ",
"๐ŸŽ‘",
"๐Ÿ“ฎ",
"๐Ÿ’ธ",
"๐Ÿž",
"๐ŸŽ’",
"\U000e0021",
"๐Ÿงฎ",
"๐ŸŽ",
"๐Ÿฆ‘",
"\U0001fad6",
"๐Ÿ“†",
"๐Ÿง",
"๐Ÿ’ฟ",
"๐Ÿ‘",
"๐Ÿ˜ฏ",
"โ›บ",
"๐ŸฅŒ",
"๐Ÿ’",
"๐Ÿ‘—",
"๐Ÿค",
"๐Ÿฃ",
"๐Ÿ‰‘",
"๐Ÿˆฏ",
"๐Ÿป",
"\U000e0027",
"\U000e0056",
"๐Ÿฆ",
"๐Ÿฆ",
"๐Ÿง",
"๐Ÿ“…",
"๐Ÿ†•",
"๐Ÿ‘ฏ",
"๐Ÿ˜ฅ",
"๐ŸงŠ",
"๐Ÿš‰",
"๐Ÿ’ฑ",
"๐Ÿฆข",
"๐Ÿ˜‡",
"๐Ÿ•",
"๐Ÿ“น",
"๐Ÿšƒ",
"๐Ÿ™",
"๐Ÿป",
"๐Ÿ”’",
"๐Ÿฆฉ",
"๐Ÿ“Ž",
"๐Ÿ˜›",
"๐Ÿ™‰",
"๐ŸŒผ",
"๐Ÿ‘‚",
"๐Ÿฅ…",
"๐Ÿค›",
"โƒฃ",
"๐Ÿ‘’",
"๐ŸŽณ",
"\U000e0059",
"๐Ÿ“ป",
"๐Ÿค•",
"๐Ÿฐ",
"๐Ÿ•™",
"๐Ÿธ",
"๐Ÿฃ",
"๐Ÿ’‰",
"๐Ÿ‹",
"๐ŸŽ‡",
"๐Ÿช•",
"๐Ÿช",
"๐Ÿš",
"โ™‰",
"\U0001fa97",
"๐Ÿฆถ",
"\U0001f6d6",
"๐Ÿฆฝ",
"๐Ÿฒ",
"\U000e0060",
"๐Ÿ’‹",
"๐Ÿงฆ",
"๐Ÿ…",
"๐Ÿ’ฆ",
"\U000e0035",
"๐Ÿ“•",
"\U0001fab3",
"๐Ÿงฒ",
"๐Ÿ’ฐ",
"๐Ÿ’ฌ",
"๐Ÿ’š",
"๐Ÿงƒ",
"๐ŸŠ",
"๐Ÿงด",
"๐ŸŒต",
"๐Ÿšฑ",
"๐Ÿšธ",
"๐Ÿš™",
"๐ŸŽถ",
"๐Ÿ‘ช",
"\U000e0068",
"๐Ÿฉ",
"๐Ÿ˜พ",
"๐Ÿ’‡",
"๐Ÿ”ณ",
"๐Ÿ˜—",
"โ™Œ",
"๐Ÿ“ท",
"๐Ÿ†’",
"๐Ÿฅผ",
"๐ŸŒ•",
"๐Ÿ†",
"๐Ÿ™‹",
"\U000e0074",
"๐Ÿ‡ถ",
"๐ŸŸฃ",
"๐Ÿšก",
"\U0001fad5",
"๐ŸŒ",
"๐Ÿš€",
"๐Ÿ“—",
"๐Ÿ’Œ",
"โ›ฒ",
"๐Ÿ",
"๐Ÿง‡",
"\U0001faa5",
"๐Ÿ›„",
"๐ŸŒ˜",
"๐ŸŒ€",
"๐Ÿช’",
"๐Ÿฅบ",
"๐Ÿงก",
"๐Ÿ”ก",
"๐Ÿฎ",
"๐Ÿน",
"โšช",
"๐Ÿฆš",
"๐Ÿคข",
"๐Ÿฅจ",
"๐Ÿ—ป",
"๐Ÿ“ณ",
"๐Ÿ™ˆ",
"๐Ÿ‡ง",
"๐Ÿฅ‚",
"๐Ÿ›ƒ",
"๐Ÿฅฑ",
"๐Ÿข",
"๐Ÿฆช",
"๐ŸŒ›",
"๐ŸŽฎ",
"๐Ÿ”ซ",
"๐Ÿค”",
"๐Ÿธ",
"๐Ÿ‡ฏ",
"\U0001fac2",
"\U000e004d",
"๐ŸŒ–",
"๐Ÿˆ",
"๐Ÿ™",
"๐Ÿ’",
"๐Ÿฌ",
"๐Ÿ’",
"๐Ÿ‡ฆ",
"๐Ÿ„",
"๐Ÿค",
"๐Ÿน",
"๐Ÿฝ",
"๐Ÿ’•",
"๐ŸฅŽ",
"๐ŸŽ",
"\U000e0048",
"๐Ÿ“",
"๐Ÿ”บ",
"๐Ÿ",
"๐Ÿ‡",
"\U0001fa9d",
"\U0001f9ad",
"๐Ÿ•Œ",
"\U000e0046",
"๐Ÿ›ฌ",
"๐Ÿ“บ",
"๐Ÿฆœ",
"๐Ÿšท",
"\U000e0028",
"๐Ÿฃ",
"๐ŸฆŠ",
"๐Ÿ™†",
"๐Ÿ˜ฆ",
"๐Ÿ’พ",
"๐Ÿฅ‡",
"๐Ÿ“ฟ",
"๐Ÿ†–",
"๐Ÿฅฟ",
"๐Ÿ•˜",
"๐ŸŽ€",
"๐Ÿฉฒ",
"๐Ÿฅฐ",
"\U0001fac1",
"๐Ÿ’",
"๐ŸŒŽ",
"๐Ÿฅ",
"๐Ÿšถ",
"๐Ÿฌ",
"๐Ÿš",
"๐Ÿ•“",
"๐Ÿน",
"๐Ÿ‰",
"๐Ÿ“™",
"๐Ÿคต",
"๐Ÿฅ–",
"\U000e004b",
"๐Ÿคน",
"โ›Ž",
"๐Ÿ”›",
"๐Ÿ˜ฐ",
"๐ŸŒบ",
"๐Ÿ˜ˆ",
"๐Ÿ‘ป",
"๐Ÿ”–",
"๐Ÿฅฃ",
"๐Ÿ”œ",
"๐Ÿ…",
"\U0001fa85",
"โ›„",
"๐Ÿ˜’",
"๐Ÿฆฟ",
"๐Ÿ˜‚",
"๐ŸŸก",
"๐Ÿงฉ",
"๐Ÿšด",
"๐Ÿฅต",
"๐Ÿค’",
"๐Ÿฉบ",
"๐Ÿ“Ÿ",
"๐Ÿคง",
"\U000e0029",
"๐Ÿ‡ธ",
"๐Ÿ„",
"๐Ÿ™„",
"๐Ÿšซ",
"\U000e007e",
"๐Ÿ˜",
"๐ŸŒฝ",
"๐ŸŸ ",
"๐Ÿš›",
"๐Ÿคฌ",
"โ™ฟ",
"๐Ÿ’ฉ",
"๐Ÿ’",
"\U000e002f",
"\U0001fa96",
"๐Ÿ’ง",
"๐Ÿ‡จ",
"๐Ÿ”",
"๐ŸงŸ",
"๐Ÿข",
"\U0001f6fb",
"๐Ÿ•บ",
"๐Ÿ”‘",
"๐Ÿ˜ค",
"๐Ÿ‘Ÿ",
"๐Ÿ",
"๐Ÿ’ž",
"๐Ÿ“ข",
"\U000e0069",
"๐Ÿ“",
"โœจ",
"๐Ÿšผ",
"\U000e007b",
"๐Ÿซ",
"๐Ÿ‘†",
"\U000e0045",
"\U0001fa9f",
"๐Ÿ–•",
"โ›ณ",
"๐Ÿญ",
"๐Ÿƒ",
"๐Ÿง›",
"๐Ÿค",
"๐Ÿง•",
"๐Ÿ†™",
"โšก",
"๐Ÿงบ",
"๐Ÿ’„",
"๐Ÿฅฆ",
"๐Ÿฆฆ",
"๐Ÿ‡บ",
"๐Ÿฅป",
"\U000e0063",
"\U0001f9a3",
"๐Ÿ’Ž",
"\U0001fac0",
"๐Ÿฅ",
"๐Ÿ‘œ",
"๐Ÿšฉ",
"๐Ÿ‘–",
"๐Ÿง‚",
"๐ŸŸง",
"\U000e007c",
"๐Ÿ“‡",
"๐Ÿ‡ฐ",
"๐Ÿšž",
"๐ŸŽฌ",
"๐Ÿช”",
"\U0001faa4",
"โž—",
"๐Ÿฅ™",
"๐ŸŽ",
"๐Ÿšฝ",
"๐ŸŒพ",
"โ—",
"๐Ÿ•—",
"๐Ÿ”ฝ",
"๐ŸŸช",
"\U0001fad2",
"๐Ÿฅง",
"๐Ÿฅณ",
"๐ŸŸฅ",
"๐Ÿฆž",
"๐Ÿ“ผ",
"๐Ÿ",
"\U0001fa9e",
"๐Ÿ”ƒ",
"๐Ÿฅ’",
"๐ŸŽต",
"๐Ÿ••",
"๐Ÿฆณ",
"๐Ÿ—",
"๐Ÿ‘",
"๐Ÿงœ",
"๐Ÿต",
"๐Ÿฆ™",
"\U000e0051",
"๐Ÿป",
"๐Ÿงˆ",
"๐Ÿ‘™",
"โœ…",
"๐Ÿค˜",
"๐Ÿช",
"๐Ÿฅ ",
"\U000e0020",
"\U000e0062",
"๐Ÿ‘",
"\U000e0079",
"๐Ÿ“ฌ",
"\U0001f9ab",
"\U000e006e",
"๐Ÿšฅ",
"๐Ÿ“จ",
"๐Ÿ”ฎ",
"๐Ÿ‘ค",
"๐Ÿญ",
"๐Ÿ“ด",
"๐Ÿ",
"๐Ÿ‡ผ",
"๐Ÿ‰",
"๐Ÿš•",
"๐Ÿ‘",
"๐ŸŽก",
"๐Ÿ•›",
"๐Ÿš ",
"๐Ÿซ",
"๐Ÿ˜",
"๐Ÿš‚",
"๐Ÿ›ซ",
"๐Ÿ˜ฟ",
"๐Ÿ",
"๐Ÿ’’",
"๐Ÿ’",
"๐Ÿšฆ",
"\U000e0061",
"๐Ÿšค",
"๐Ÿ˜™",
"โช",
"๐Ÿฆ‡",
"โฉ",
"๐ŸŒ™",
"๐Ÿ‡ฒ",
"๐Ÿ“",
"๐Ÿ†š",
"๐Ÿงฑ",
"๐Ÿ‘‹",
"\U000e0038",
"๐ŸŽค",
"๐Ÿ•ค",
"๐Ÿคธ",
"๐Ÿ˜Œ",
"๐Ÿ•ฅ",
"๐ŸŒณ",
"๐ŸŽฅ",
"๐Ÿ”Š",
"๐Ÿ‘ฉ",
"๐Ÿคท",
"โ›ฝ",
"๐Ÿฆ„",
"๐Ÿ™",
"๐ŸŸข",
"๐Ÿ‡ซ",
"๐Ÿ‘Ž",
"๐Ÿค",
"๐ŸŒœ",
"โ›ช",
"\U000e0067",
"๐Ÿผ",
"๐Ÿ‘ฐ",
"๐Ÿฅฝ",
"๐Ÿผ",
"๐Ÿ”ฒ",
"๐Ÿ‡ณ",
"๐Ÿ˜ถ",
"๐Ÿฅซ",
"๐Ÿงง",
"๐Ÿ˜Š",
"๐Ÿ‘น",
"๐ŸŒƒ",
"๐Ÿ‘ฆ",
"๐Ÿช‚",
"๐Ÿ’ต",
"๐Ÿ‘ฟ",
"๐Ÿ“ก",
"๐Ÿ€",
"๐Ÿ“ฏ",
"๐Ÿด",
"โซ",
"๐Ÿงฌ",
"๐ŸŒฟ",
"๐Ÿˆถ",
"๐Ÿช",
"โฐ",
"๐Ÿ”™",
"๐Ÿ•‹",
"๐Ÿˆš",
"๐Ÿ‡ฑ",
"๐Ÿงฐ",
"๐Ÿ”ธ",
"๐Ÿ™",
"๐Ÿš",
"๐Ÿš",
"๐Ÿ˜",
"๐Ÿ”Ÿ",
"๐Ÿ˜‘",
"๐Ÿงข",
"๐Ÿ‘„",
"๐ŸŽง",
"๐Ÿงž",
"๐Ÿฉณ",
"๐Ÿ˜ข",
"\U000e0032",
"\U000e005b",
"๐Ÿ”น",
"๐Ÿฅ",
"๐Ÿ‘ฑ",
"๐Ÿ˜",
"๐Ÿ““",
"๐Ÿฆ",
"๐ŸŸ",
"\U000e0041",
"โ™ˆ",
"๐Ÿˆน",
"๐Ÿ“€",
"๐Ÿ”",
"๐Ÿผ",
"โ™Š",
"๐Ÿงฏ",
"๐Ÿ‘บ",
"๐Ÿ‘",
"๐Ÿ•ข",
"๐Ÿ‘…",
"โ›…",
"๐Ÿค",
"๐Ÿ˜ฒ",
"๐Ÿšฌ",
"โ“",
"๐ŸŒ‘",
"๐Ÿฆ˜",
"๐Ÿ‡ท",
"\U0001fab4",
"๐Ÿฅ‘",
"๐Ÿฆฐ",
"๐Ÿ‡ฎ",
"โ™",
"๐Ÿš‡",
"\U000e003d",
"๐Ÿ˜Ÿ",
"๐ŸŒ…",
"๐ŸŽฑ",
"๐Ÿ”จ",
"๐Ÿฆ’",
"๐Ÿ”ž",
"๐Ÿšญ",
"๐Ÿ‰",
"\U0001f6d7",
"๐Ÿ•",
"๐Ÿ‘ถ",
"๐Ÿ˜จ",
"โ™Ž",
"๐Ÿฅ•",
"\U000e005a",
"๐Ÿฆ",
"โ”",
"๐Ÿ“ˆ",
"\U000e0058",
"๐Ÿงถ",
"๐Ÿฅ˜",
"๐Ÿ™Œ",
"๐Ÿ’ผ",
"๐Ÿ ",
"\U000e005d",
"๐ŸŸค",
"๐Ÿšจ",
"๐Ÿคพ",
"๐Ÿ”†",
"๐Ÿคด",
"๐Ÿ…",
"๐Ÿ“ช",
"๐Ÿงฃ",
"๐Ÿ‘‡",
"๐Ÿ‘ด",
"๐Ÿ“Š",
"\U000e003e",
"๐ŸฆŒ",
"\U000e0078",
"๐Ÿถ",
"๐Ÿ˜ท",
"๐Ÿ˜ฝ",
"๐Ÿฆ",
"\U0001fad0",
"๐Ÿ’ช",
"๐Ÿฅ“",
"\U0001fa84",
"๐Ÿ‘ผ",
"๐Ÿ€",
"๐Ÿ’Š",
"โ›”",
"\U000e004e",
"โšซ",
"๐Ÿ˜‹",
"๐Ÿ‘‰",
"๐Ÿƒ",
"๐Ÿพ",
"๐Ÿคฉ",
"๐Ÿ†—",
"\U0001f9cb",
"๐Ÿ”˜",
"๐Ÿคฐ",
"๐Ÿ˜€",
"๐Ÿš—",
"๐Ÿšพ",
"๐Ÿคญ",
"๐Ÿฆ…",
"๐Ÿฆƒ",
"๐Ÿ†Ž",
"๐Ÿ‘ญ",
"๐Ÿ›Œ",
"๐ŸŒฑ",
"๐Ÿ™Ž",
"๐Ÿ™‡",
"๐Ÿ˜น",
"๐Ÿงจ",
"๐ŸŒ—",
"๐Ÿฉฑ",
"๐Ÿฆ€",
"๐Ÿง",
"๐Ÿ˜“",
"๐Ÿ‚",
"๐ŸšŸ",
"โœŠ",
"\U000e0044",
"๐Ÿฅด",
"๐Ÿšฃ",
"\U000e0039",
"โ™",
"๐Ÿงณ",
"๐Ÿง’",
"๐Ÿฅญ",
"๐Ÿฆ“",
"๐Ÿšข",
"๐Ÿคฏ",
"๐Ÿ‘ ",
"โœ‹",
"๐Ÿ˜ธ",
"\U0001faa3",
"๐Ÿ’ฎ",
"๐Ÿ“ถ",
"๐Ÿ’ญ",
"๐Ÿšณ",
"๐Ÿ‘จ",
"โ™‹",
"๐Ÿง",
"๐Ÿบ",
"๐Ÿ”ˆ",
"๐Ÿ’—",
"๐ŸŽฝ",
"๐Ÿ›บ",
"๐Ÿง–",
"๐Ÿคจ",
"\U000e003c",
"๐Ÿฉน",
"๐Ÿคณ",
"๐Ÿšป",
"๐Ÿ‡ฌ",
"๐Ÿ–",
"๐ŸŽฏ",
"๐Ÿ†",
"๐Ÿฐ",
"๐Ÿˆธ",
"๐Ÿฅ”",
"๐Ÿฟ",
"๐Ÿ’Ÿ",
"๐Ÿ”ฐ",
"๐Ÿ”‡",
"๐ŸŒ”",
"๐Ÿฅ›",
"๐Ÿฌ",
"๐Ÿคผ",
"๐Ÿงป",
"๐Ÿฅฉ",
"๐Ÿ‘ธ",
"๐ŸŽจ",
"๐Ÿ”ฅ",
"๐Ÿงน",
"๐Ÿ–",
"๐Ÿ˜ฎ",
"๐Ÿ†”",
"๐Ÿ˜ฑ",
"๐Ÿ”",
"๐Ÿ˜Ž",
"๐Ÿ˜ฌ",
"๐Ÿคถ",
"๐Ÿ’ท",
"๐Ÿฅช",
"๐Ÿ›ถ",
"๐Ÿ“",
"๐Ÿ›ด",
"๐Ÿงญ",
"๐ŸŽญ",
"๐Ÿˆณ",
"๐Ÿ’",
"๐Ÿช",
"๐Ÿฆ”",
"๐Ÿ›’",
"โžฐ",
"\U0001f90c",
"๐Ÿš˜",
"๐ŸŒฎ",
"๐Ÿฆ‚",
"๐Ÿ”ฑ",
"๐Ÿค“",
"๐Ÿˆ",
"๐ŸŽธ",
"๐Ÿฆ›",
"\U000e002d",
"๐Ÿฅž",
"๐Ÿ›ต",
"\U0001faa0",
"๐Ÿ",
"\U000e006d",
"๐Ÿ‡ต",
"๐Ÿ”Ž",
"๐Ÿ“ฆ",
"๐Ÿ–ค",
"๐ŸŽ†",
"๐Ÿงท",
"\U000e006c",
"๐Ÿ“ž",
"๐Ÿ“ญ",
"๐ŸŽซ",
"โณ",
"๐Ÿ›",
"๐Ÿท",
"\U000e0022",
"\U000e0024",
"๐Ÿ’–",
"โšพ",
"๐ŸŽ‹",
"\U0001fab5",
"๐Ÿ“’",
"๐Ÿ‘",
"๐Ÿฎ",
"๐Ÿ„",
"โญ•",
"๐Ÿท",
"๐Ÿ“",
"๐Ÿ‘›",
"๐Ÿš",
"\U000e007d",
"๐ŸŒ",
"๐ŸŒš",
"๐Ÿช",
"๐Ÿ•‘",
"๐Ÿ˜",
"\U000e0075",
"๐Ÿ˜…",
"๐ŸŽฟ",
"๐Ÿ”‰",
"๐Ÿฅƒ",
"๐Ÿšต",
"๐ŸŸจ",
"๐Ÿ”ต",
"๐Ÿด",
"๐Ÿ•ฆ",
"\U000e0073",
"๐Ÿ˜ป",
"๐Ÿ™…",
"โ—ฝ",
"โž•",
"๐Ÿˆฒ",
"\U000e0065",
"๐Ÿ•š",
"๐Ÿ‡น",
"๐Ÿ˜ ",
"๐Ÿฅถ",
"๐Ÿ•–",
"๐Ÿ”„",
"๐Ÿคช",
"๐Ÿค ",
"๐Ÿ‘ฎ",
"๐Ÿ”‹",
"๐Ÿค‘",
"\U000e007f",
"๐ŸŒ",
"๐Ÿคฅ",
"๐Ÿ’…",
"โญ",
"๐Ÿคœ",
"๐ŸŽƒ",
"๐Ÿšš",
"๐Ÿ’“",
"๐Ÿœ",
"๐Ÿšฐ",
"๐Ÿง€",
"๐Ÿถ",
"๐ŸŽฐ",
"๐Ÿคค",
"๐Ÿงฅ",
"๐Ÿ€",
"\U000e0037",
"๐Ÿฆฅ",
"๐Ÿบ",
"๐Ÿ‡ฝ",
"โฌœ",
"๐Ÿฅš",
"โŽ",
"๐Ÿฆก",
"๐Ÿ‡",
"๐Ÿฆพ",
"๐Ÿค",
"๐Ÿฏ",
"๐Ÿ‘€",
"๐Ÿ‘ž",
"๐Ÿง†",
"๐Ÿ",
"๐ŸŒ’",
"๐Ÿ˜˜",
"๐ŸšŽ",
"๐Ÿ™€",
"๐Ÿคž",
"\U0001f6fc",
"๐Ÿฅ—",
"๐Ÿ“‚",
"\U000e0040",
"\U000e006f",
"๐Ÿ“„",
"๐ŸŽฉ",
"๐Ÿ•ก",
"๐Ÿšช",
"๐Ÿ”ง",
"๐Ÿ˜ฉ",
"๐Ÿ—ฟ",
"๐Ÿฆ—",
"๐ŸŒž",
"\U0001f972",
"๐Ÿฅ€",
"๐ŸŽ„",
"๐Ÿงช",
"\U000e0043",
"๐Ÿ”ป",
"๐Ÿช‘",
"๐Ÿ”ฌ",
"\U000e0052",
"๐Ÿ“ธ",
"๐Ÿคฝ",
"\U0001fa86",
"๐Ÿง™",
"\U000e0025",
"๐Ÿ™ƒ",
"๐Ÿ™‚",
"๐Ÿ’˜",
"๐ŸŒฒ",
"๐Ÿ•ฃ",
"๐Ÿ•",
"\U0001faa7",
"\U000e003a",
"\U0001fad4",
"โ™‘",
"๐Ÿ›…",
"๐Ÿ˜ญ",
"๐Ÿ”",
"โ•",
"๐Ÿ†",
"๐Ÿฏ",
"๐Ÿ“ฉ",
"๐ŸŒธ",
"๐Ÿ”ฏ",
"๐Ÿฆ‹",
"๐ŸฆŽ",
"๐Ÿฆฑ",
"๐Ÿ”ช",
"๐Ÿฏ",
"๐Ÿฉ",
"๐Ÿ˜ซ",
"๐Ÿฟ",
"\U000e002b",
"\U0001fa9c",
"\U0001faa8",
"๐Ÿ“ฒ",
"๐Ÿšบ",
"๐Ÿฆ",
"๐ŸŒน",
"๐Ÿฆต",
"๐Ÿฝ",
"๐ŸŒ†",
"๐ŸŒด",
"๐Ÿ‘ฃ",
"๐Ÿงš",
"๐ŸŠ",
"๐Ÿ“‹",
"๐Ÿ†‘",
"๐Ÿซ",
"๐Ÿงฝ",
"๐Ÿ’",
"๐Ÿฆธ",
"๐Ÿ‘ฝ",
"๐Ÿ—พ",
"๐Ÿง",
"\U000e0026",
"\U000e006b",
"๐Ÿคฎ",
"๐Ÿ”‚",
"๐ŸŒŸ",
"๐Ÿ—ผ",
"๐Ÿ",
"๐Ÿ”ฉ",
"๐Ÿ‘ฅ",
"๐Ÿ˜ƒ",
"๐Ÿฉฐ",
"๐ŸŽ",
"๐Ÿบ",
"๐Ÿ“",
"๐Ÿ˜ต",
"๐Ÿšฏ",
"โžฟ",
"๐Ÿ’‘",
"๐ŸŽฃ",
"๐Ÿฆผ",
"๐Ÿง ",
"๐Ÿ”€",
"๐Ÿฅฎ",
"๐Ÿ ",
"๐Ÿ—",
"\U000e0054",
"๐Ÿฆน",
"๐Ÿ’ฅ",
"๐Ÿ”ท",
"๐Ÿƒ",
"๐ŸŽข",
"๐Ÿ’บ",
"๐Ÿ›ท",
"๐ŸŽด",
"๐ŸŽฒ",
"๐Ÿฆป",
"๐Ÿ‡พ",
"๐ŸŒ",
"โŒ›",
"๐Ÿ‚",
"๐Ÿ˜ผ",
"๐Ÿฆ†",
"\U0001fad3",
"\U0001fad1",
"๐Ÿ’‚",
"\U0001fa99",
"๐Ÿ”ข",
"๐ŸŒ„",
"๐Ÿ‘“",
"๐Ÿฅฅ",
"โ›ต",
"\U0001fa9b",
"๐Ÿˆ",
"๐Ÿ”",
"๐Ÿ›•",
"๐Ÿ‘˜",
"๐Ÿ‘ณ",
"๐Ÿฅฏ",
"๐Ÿฅก",
"๐Ÿ‰",
"๐Ÿ’™",
"๐Ÿ‘•",
"๐Ÿช“",
"๐Ÿง",
"\U000e007a",
"๐Ÿ‘",
"๐Ÿ˜ฃ",
"๐Ÿ“ซ",
"๐Ÿ’จ",
"๐Ÿงฟ",
"\U0001fa83",
"๐Ÿ",
"\U0001fab6",
"๐Ÿ‘ฒ",
"๐Ÿง˜",
"๐Ÿ›",
"๐ŸŒ“",
"๐Ÿš–",
"๐Ÿก",
"๐Ÿš†",
"๐Ÿ’ก",
"๏ธ",
"๐ŸŽŒ",
"๐Ÿงผ",
"๐Ÿ‘ง",
"\U0001f978",
"๐Ÿ“ง",
"๐ŸŽ‚",
"๐Ÿ’›",
"๐Ÿ’ซ",
"๐Ÿ’”",
"๐Ÿฒ",
"๐Ÿ”Œ",
"๐Ÿ‡ป",
"๐ŸšŠ",
"๐ŸŸซ",
"๐Ÿฅ",
"\U0001fab2",
"๐Ÿš”",
"\U000e0055",
"\U0001faa6",
"๐Ÿ”ฃ",
"๐ŸŽบ",
"๐Ÿฆ ",
"๐Ÿ ",
"๐Ÿ”ด",
"๐Ÿž",
"๐Ÿ˜ก",
"๐Ÿข",
"๐Ÿ˜•",
"โ™’",
"๐Ÿ’ณ",
"๐Ÿšฎ",
"๐Ÿ”š",
"๐Ÿคซ",
"๐Ÿฆ•",
"๐ŸŒ‚",
"๐Ÿš“",
"๐Ÿงต",
"๐Ÿฅฌ",
"๐Ÿ˜”",
"๐ŸฅŠ",
"๐Ÿ›",
"๐Ÿ’ฝ",
"โฌ",
"๐Ÿˆบ",
"๐Ÿฆฎ",
"๐Ÿฆ‰",
"\U000e0047",
"๐ŸŽ…",
"\U000e0050",
"๐ŸŽฆ",
"๐Ÿคฑ",
}
async def get_random_emoji_list(emoji_list: set) -> list:
"""Generates and returns a list of random emojis from a list of all available emojis.
Uses secure random generator https://docs.python.org/3.6/library/secrets.html
"""
return [emoji_list.pop() for x in range(secrets.randbelow(4) + 3)]
async def generate_key(filename):
"""Generates a key in form of a dictionary byte:emoji_list.
Stores key as key.emojipher. Overwrites existing key if exists!
1. Generate a list of all emojis.
2. Generate a dictionary of bytes 0 - 256 and their list of emoji.
3. Store key as key.emojipher.
"""
print("๐Ÿ‘๐Ÿ‘ Generating key, I am not looking...")
emojis = await get_all_emojis()
key = {x: await get_random_emoji_list(emojis) for x in range(0, 256)}
with open(filename + ".emojipher", "w") as f:
# Write as string, can evaluate string to dict when reading key.
f.write(str(key))
print("๐Ÿง‘โ€๐Ÿ’ป๐Ÿค Key has been generated! Keep it safe.")
async def encrypt_data(filename: str, key: str):
"""Encrypts given file with given key. If such file exists, it is deleted!
1. Load key.
2. Iterate file bytes.
2.1. Convert byte to int and find matching key in dict.
2.2. Pick one random emoji from according list,
2.3. Append to file.
"""
print("๐Ÿง™๐Ÿผ๐Ÿ”ฅ Encrypting your data...")
with open(key, "r") as fr:
key = ast.literal_eval(fr.read())
output_filename = filename + ".encrypted"
# Remove existing file if needed.
if os.path.exists(output_filename):
os.remove(output_filename)
with open(filename, "rb") as fr:
byte = fr.read(1)
while byte != b"":
# Convert byte to int to match in key dictionary.
b = int.from_bytes(byte, "little")
byte = fr.read(1)
with open(output_filename, "a") as fw:
# Find matching random emoji and write to file.
fw.write(secrets.choice(key[b]))
print(
"๐Ÿ•ต ๐Ÿ•ต๏ธโ€โ™‚๏ธ Your data has been encrypted and is safe from bioluminescent agents."
)
async def decrypt_data(filename: str, key: str):
"""Given a filename and a key, decrypts data into original file."""
print("๐Ÿ‘€๐Ÿ‘ฝ Decrypting data, make sure you are alone!")
with open(key, "r") as fr:
key = ast.literal_eval(fr.read())
# Invert key, aka make each emoji in list of each key into a new key.
# So one key with list of 5 emojis becomes 5 keys with same value of byte.
inverted_key = {}
for k, v in key.items():
for e in v:
inverted_key[e] = k.to_bytes(1, "little")
output_filename = filename.replace(".encrypted", ".decrypted")
if os.path.exists(output_filename):
os.remove(output_filename)
with open(filename, "r", encoding="utf-8") as fr:
while True:
c = fr.read(1)
if not c:
break
with open(output_filename, "ab") as fw:
fw.write(inverted_key[c])
print("๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป๐Ÿ–จ Your data has been decrypted. Have fun!")
if __name__ == "__main__":
parser = ArgumentParser(
description=description, formatter_class=RawDescriptionHelpFormatter
)
generate = parser.add_argument_group("key generation")
generate.add_argument("-g", "--generate", type=str, help="key name")
group = parser.add_mutually_exclusive_group()
group.add_argument("-e", "--encrypt", type=str, help="file(s) to encrypt")
group.add_argument("-d", "--decrypt", type=str, help="file(s) to decrypt")
group.add_argument("-c", "--changelog", action="store_true", help="see whats new!")
parser.add_argument("-k", "--key", type=str, help="path to key")
args = parser.parse_args()
if args.generate:
# await generate_key(args.generate)
loop = asyncio.get_event_loop()
loop.run_until_complete(generate_key(args.generate))
loop.close()
elif args.encrypt:
# await encrypt_data(args.encrypt, args.key)
loop = asyncio.get_event_loop()
loop.run_until_complete(encrypt_data(args.encrypt, args.key))
loop.close()
elif args.decrypt:
# await decrypt_data(args.decrypt, args.key)
loop = asyncio.get_event_loop()
loop.run_until_complete(decrypt_data(args.decrypt, args.key))
loop.close()
elif args.changelog:
print(changelog)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment