Last active
May 5, 2018 15:38
-
-
Save DanyelMorales/c02af49d47fb4aa82afd58dfae1bf3ed to your computer and use it in GitHub Desktop.
Python3 custom encode algorithm using mathematical logarithms (highly insecure)
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 math | |
import base64 | |
import functools | |
text="hola"; | |
base=len(text); | |
acum=[]; | |
for x in text: | |
mychr=math.log(ord(x), base); | |
encoded=str(mychr); | |
enc2=""; | |
for y in encoded.split('.') : | |
enc2 += y + "@" | |
acum.append(enc2); | |
b64encoded=base64.b64encode(functools.reduce(lambda x,y: x+"###"+y, acum).encode('ascii')) | |
print(b64encoded); | |
# b'M0AzNTAyMTk4NTkwNzA1NDZAIyMjM0AzOTcyMDc5MzMxNzUwNTNAIyMjM0AzNzc0NDM3NTEwODE3MzQ2QCMjIzNAMjk5OTU2NDIxMDkzNTY0QA==' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment