Created
July 1, 2023 13:18
-
-
Save LunaNyan/bc820bbc406e36abb83dcb8c77f74eb4 to your computer and use it in GitHub Desktop.
쓸데없지만 멋있는 암호문 생성기
This file contains 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
import random | |
def generate(text): | |
for i in text: | |
if not 32 <= ord(i) <= 126: | |
raise ValueError("Messages must consist of only basic printable ASCII codes") | |
tlst = list() | |
while len(text) > 0: | |
if len(text[:2]) == 1: | |
r = text + " " | |
else: | |
r = text[:2] | |
tlst.append(r) | |
text = text[2:] | |
tres = "" | |
for i in tlst: | |
mul = random.randint(1, 32) | |
if mul > 16: | |
mulcode = chr(80+mul) | |
else: | |
mulcode = chr(64+mul) | |
ta = str(ord(i[0]) * (32 + mul)) | |
tb = str(ord(i[1]) * (32 + mul)) | |
ta = ta[:2].zfill(2) + "-" + ta[2:].zfill(2) | |
tb = tb[:2].zfill(2) + "-" + tb[2:].zfill(2) | |
tres += f"{ta}-{tb}-{mulcode}\n" | |
return tres |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment