Skip to content

Instantly share code, notes, and snippets.

Created Feb 19, 2011
What would you like to do?
#! /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