For a sample of how it works, look at this paragraph from my previous post:
Before:
Spent some time today installing a barebones (ie. no desktop) version of Ubuntu on an old Acer Aspire One netbook. Feels weird to refer to it as old, as it was only a few years ago....
After:
S|>en† So]V[e †!]V[e †o])ay !nS†aLL!nG a (3aRe(3oneS (!e. no ])eS|<†o|>) veRS!on of µ(3µn†µ on an oL]) aceR aS|>!Re one ne†(3oo|<. feeLS UUe!R]) †o RefeR †o !† aS oL]), aS !† UUaS onLy a feUU yeaRS aGo....
Here's the code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# leet.py
# an experiment in python to produce a good leet encoder
# that does not use a one-to-one mapping
# mFragin May 2011
# version 1.5  maps first and then substitutes, so 
# each example is internally letter consistant
import random, string
myDefinitions = [["4","@","/-\\","∂","λ","a","A"],
["6","I3","ß","|:","(3","/3","b","B"],
["¢","(","©","c","C"],
["∂","])","[)","T)","cl","d","D"],
["€","£","ë","e","E"],
["]=","ph","|=","f","F"],
["6","(_+","9","(γ","(_-","cj","g","G"],
["/-/","]-[",")-(","|~|","]~[","}{","h","H"],
["!","|",":","i","I"],
["_|","_/","]","j","J"],
["|<","k","K"],     ["1","|","|_","l","L"],     ["|v|","]V[","(T)","|\\/|","/\\/\\","m","M"],     ["|\\|","]\\[","~","n","N"],     ["0","[]","¤","Ω","o","O"],     ["|o","|>","p","P"],
["(_,)","0_","O,","q","Q"],
["12","®","|2","r","R"],
["5","$","§","s","S"],
["+","-|-","†","t","T"],
["|_|","L|","µ","u","U"],
["\\/","√","v","V"],
["vv","\\V/","\\X/","UU","w","W"],
["%","><","}{","x","X"],     ["Ψ","¥","y","Y"],     ["2","z","Z"]]  myKeys = string.ascii_lowercase  # Make a dictionary of the keys and values  myDict =dict(zip(myKeys, myDefinitions))  # Get a string from user and make it lower case  stringToConvert = raw_input("\nEnter a string: ").lower() leetString = ""  variations = int(raw_input("\nHow many variations? "))  for i in range(variations):     leetString = ""     chosenLetters = {}     for letter in stringToConvert:         if letter in chosenLetters:             leetString += chosenLetters[letter]         elif letter in string.ascii_lowercase:             choice = random.choice(myDict[letter])             leetString += choice             chosenLetters[letter] = choice         else:             leetString += letter      print leetString

 
 

No comments:
Post a Comment