Skip to content

Instantly share code, notes, and snippets.

@garrettr
Created December 2, 2013 01:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garrettr/7743498 to your computer and use it in GitHub Desktop.
Save garrettr/7743498 to your computer and use it in GitHub Desktop.
SecureDrop Wordlist Rainbow Table Math
#!/usr/bin/env python
import sys
wordlist_filename = sys.argv[1]
words = []
with open(wordlist_filename) as wl_fp:
for line in wl_fp:
words.append(line.strip())
num_words = len(words)
print "%s words in wordlist" % num_words
num_possible_passphrases = num_words**8
print "%s possible 8-word passphrases" % num_possible_passphrases
word_length_sum = 0
for word in words:
word_length_sum += len(word)
avg_word_len = float(word_length_sum) / num_words
print "%s average word length" % avg_word_len
avg_passphrase_len = avg_word_len * 8 + 7 # +7 for spaces
print "%s average passphrase length" % (avg_passphrase_len)
rainbow_table_size = avg_passphrase_len * num_possible_passphrases
print "%s bytes size of rainbow table" % rainbow_table_size
print "%s (in MB)" % (float(rainbow_table_size) / (1024**2))
print "%s (in GB)" % (float(rainbow_table_size) / (1024**3))
print "%s (in TB)" % (float(rainbow_table_size) / (1024**4))
print "%s (in PB)" % (float(rainbow_table_size) / (1024**5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment