Skip to content

Instantly share code, notes, and snippets.

@ties
Created March 14, 2012 22:21
Show Gist options
  • Save ties/2040015 to your computer and use it in GitHub Desktop.
Save ties/2040015 to your computer and use it in GitHub Desktop.
random passphrase generator
#
# Generate random word list from Linux Dictionary
#
# Based on script seen at CCC talk 4494 <http://ftp.ccc.de/events/camp2011/video/cccamp11-4494-laptop_and_electronics_searches_at_the_us_border-en.mp4> at 25:30
# (c) Electronic Fronteer Foundation (it's from the presentation)
import random, math
d = open('/usr/share/dict/words').readlines()
n = 5
print ' '.join(random.choice(d).rstrip() for i in range(n))
print n * math.log(len(d))/math.log(2), 'bits'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment