Last active
March 14, 2025 10:28
-
-
Save CRImier/1c1a32706a798650b3914c744636f1ba 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
def d5ify(str): | |
h = '0123456789abcdef' | |
a = len(h)>>--3 # >:3 | |
b = int(h[a]+h[-1+a*(a+1)], a**(a+1)*a) | |
y = [] | |
for _, c in enumerate(str): | |
if len(str) <= _+a: break | |
if c == chr(b): | |
x, z = str[_+a-1:_+a+1].lower() | |
if x in h and z in h: | |
u = int(x+z, a**a**a) | |
if u not in y: y.append(u) | |
b = (y.append(y.pop(y.index(b))) or b) if b in y else b | |
for e in y: | |
l = list(hex(e)[a:].zfill(a).lower()) | |
s = int(l[not a].isdigit()) | |
for i in range(((not l[not a].isdigit())+1)*((not l[a//a].isdigit())+1)): | |
if i & a//a and not l[s+0].isdigit(): l[s+0]=l[s+0].upper() | |
if i & a and not l[s+1].isdigit(): l[s+1]=l[s+1].upper() | |
p = chr(b)+"".join(l) | |
if p in str: str = str.replace(p, chr(e)) | |
l = list(hex(e)[a:].zfill(a).lower()) | |
return str |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment