Created
February 19, 2011 08:49
-
-
Save nelsnelson/834938 to your computer and use it in GitHub Desktop.
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
#! /usr/bin/env python | |
from sys import argv | |
from string import ascii_letters | |
from string import digits | |
from random import choice | |
from re import findall | |
n=int(argv[1]); charset=list(ascii_letters+digits+" ") | |
def generate(n): | |
return [' '.join(findall(".{2}", ''.join([choice(charset) for x in xrange(17)]).encode("hex"))) for i in xrange(n)] | |
def decode(samples): | |
return [''.join([chr(int(x, 16)) for x in a.split()]) for a in samples] | |
samples = generate(n) | |
result = decode(samples) | |
if len(argv) < 2 or argv[2] != "-q": | |
for s in result: | |
print s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment