Created
October 27, 2010 08:54
-
-
Save bussiere/648691 to your computer and use it in GitHub Desktop.
l33t encoder in python
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
# -*- coding: utf-8 -*- | |
import random | |
def encode(string,Numeric=False): | |
# a= ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"] | |
A = [4, | |
"/\\", | |
"@", | |
"^", | |
"aye", | |
"∂", | |
"/-\\", | |
"|-\\"] | |
B = [8, | |
6, | |
13, | |
3, | |
"|3", | |
"ß", | |
"P>", | |
"|:", | |
"!3", | |
"(3", | |
"/3", | |
")3", | |
"|3"] | |
C = [ | |
"[", | |
"¢", | |
"<", | |
"(", | |
"©"] | |
D = [ | |
")", | |
"|o", | |
"[)", | |
"I>", | |
"|>", | |
"?", | |
"T)", | |
"|)", | |
0] | |
E = [ | |
3, | |
"&", | |
"€", | |
"£", | |
"є", | |
"ë", | |
"[-", | |
"|=-"] | |
F = [ | |
"|=", | |
"ƒ", | |
"|#", | |
"ph", | |
"/="] | |
G = [ | |
6, | |
"&", | |
"(_+", | |
9, | |
"C-", | |
"gee", | |
"(γ,"] | |
H = [ | |
"#", | |
"/-/", | |
"[-]", | |
"]-[", | |
")-(", | |
"(-)", | |
":-:", | |
"|~|", | |
"|-|", | |
"]~[", | |
"}{", | |
"]-[", | |
"?", | |
"}-{", | |
"hèch"] | |
I = [ | |
1, | |
"!", | |
"|", | |
"][", | |
"eye", | |
"3y3", | |
"]", | |
":" | |
] | |
J = [ | |
"_|", | |
"_/", | |
"¿", | |
"</", | |
"(/", | |
"ʝ", | |
";" | |
] | |
K = [ | |
"X", | |
"|<", | |
"|{", | |
"ɮ" | |
] | |
L = [ | |
1, | |
"£", | |
"1_", | |
"ℓ", | |
"|", | |
"|_", | |
"][_," | |
] | |
M =[ | |
"|v|", | |
"[V]", | |
"{V}", | |
"|\/|", | |
"/\/\\", | |
"(u)", | |
"(V)", | |
"(\/)", | |
"/|\\", | |
"^^", | |
"/|/|", | |
"//.", | |
".\\", | |
"/^^\\", | |
"///", | |
"|^^|" | |
] | |
N =[ | |
"^/", | |
"|V", | |
"|\|", | |
"/\/", | |
"[\]", | |
"<\>", | |
"{\}", | |
"[]\\", | |
"// []", | |
"/V", | |
"₪" | |
] | |
O =[ | |
0, | |
"()", | |
"oh", | |
"[]", | |
"¤", | |
"°", | |
"([])" | |
] | |
P =[ | |
"|*", | |
"|o", | |
"|º", | |
"|^(o)", | |
"|>", | |
"|\"", | |
"9", | |
"[]D", | |
"|̊", | |
"|7", | |
"?" | |
] | |
Q =[ | |
"(_,)", | |
"()_", | |
"0_", | |
"°|", | |
"<|", | |
"0." | |
] | |
R =[ | |
2, | |
"|?", | |
"/2", | |
"|^", | |
"lz", | |
"®", | |
"[z", | |
"12", | |
"Я", | |
"|2", | |
"ʁ", | |
"|²", | |
".-", | |
",-" | |
] | |
S =[ | |
5, | |
"$", | |
"z", | |
"§", | |
"ehs", | |
"es", | |
"_/¯" | |
] | |
T =[ | |
7, | |
"+", | |
"-|-", | |
1, | |
"']['", | |
"†", | |
"|²" | |
] | |
U =[ | |
"(_)", | |
"|_|", | |
"v", | |
"L|", | |
"µ" | |
] | |
V =[ | |
"\/", | |
"1/", | |
"|/" | |
] | |
W =[ | |
"\/\/", | |
"vv", | |
"'//", | |
"\\`", | |
"\^/", | |
"(n)", | |
"\V/", | |
"\X/", | |
"\|/", | |
"\_|_/", | |
"\_:_/", | |
"Ш", | |
"ɰ", | |
"`^/", | |
"\./" | |
] | |
X =[ | |
"><", | |
"Ж", | |
"}{", | |
"ecks", | |
"×", | |
")(" | |
] | |
Y =[ | |
"j", | |
"`/", | |
"Ψ", | |
"φ", | |
"λ", | |
"Ч", | |
"¥", | |
"'/" | |
] | |
Z =[ | |
"≥", | |
2, | |
"=/=", | |
"7_", | |
"~/_", | |
"%", | |
">_", | |
"ʒ", | |
">_", | |
"-\_", | |
"'/_" | |
] | |
vocabulary = { | |
"owned":["0wn3d"], | |
"pawned": ["pwn'd","pwnt"], | |
"woot":["w00t"], | |
"hoot":["w00t"], | |
"loot":["13wt"], | |
"treasure":["13wt"], | |
"item":["13wt"], | |
"pwned":["pwn'd","pwnt"], | |
"powned":["pwn'd","pwnt"], | |
"pawns":["pwn'd","pwnt"], | |
"pawn":["pwn'd","pwnt"], | |
"hacker":["h4x0r"], | |
"hackers":["h4x0r"], | |
"fear":["ph33r","ph34r"], | |
"fears":["ph33r","ph34r"], | |
"skill":["sk1llz"], | |
"skills":["sk1llz"], | |
"mad":["m4d"], | |
"crazy":["m4d"], | |
"you":["j00"], | |
"fool":["f00"], | |
"idiot":["f00"], | |
"yo":["j0"], | |
"dude":["d00d"], | |
"pal":["d00d"], | |
"sucks":["sux0r"], | |
"suck":["sux0r"], | |
"lamer":["l4m3r"], | |
"noob":["n00b"] | |
} | |
Alphabet = { | |
"a":A, | |
"b":B, | |
"c":C, | |
"d":D, | |
"e":E, | |
"f":F, | |
"g":G, | |
"h":H, | |
"i":I, | |
"j":J, | |
"k":K, | |
"l":L, | |
"m":M, | |
"n":N, | |
"o":O, | |
"p":P, | |
"q":Q, | |
"r":R, | |
"s":S, | |
"t":T, | |
"u":U, | |
"v":V, | |
"w":W, | |
"x":X, | |
"y":Y, | |
"z":Z | |
} | |
str_return = "" | |
for word in string.split(" ") : | |
if word in vocabulary.keys(): | |
str_return += (vocabulary[word][random.randint(0,len(vocabulary[word])-1)]) + " " | |
else : | |
temp = "" | |
for c in word : | |
c = c.lower() | |
if c in Alphabet.keys(): | |
if Numeric is False : | |
temp += str(Alphabet[c][random.randint(0,len(Alphabet[c])-1)]) | |
else : | |
temp_num = [] | |
for thing in Alphabet[c] : | |
if type(thing) is int : | |
temp_num.append(thing) | |
if len(temp_num) == 0 : | |
temp += c | |
else : | |
temp += str(temp_num[random.randint(0,len(temp_num)-1)]) | |
else : | |
temp += c | |
str_return += str(temp) + " " | |
return str_return[:-1] | |
print encode("Are my skills pawns yours little girl ?",True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is awesome! Quick note:
Same can be done with
I took some portion of your code to make an hexchat plugin, which can be found here. Feel free to use it, or give feedback. Thanks so much!