Skip to content

Instantly share code, notes, and snippets.

@bholota
Created November 14, 2015 13:48
Show Gist options
  • Save bholota/83a51383c358cf88353c to your computer and use it in GitHub Desktop.
Save bholota/83a51383c358cf88353c to your computer and use it in GitHub Desktop.
Generate all combinations for given chars, combination fixed length and print them with sha256 hash
# Simple script that generate all possible string combinations for given lenght
# and generates sha256 hashes for every combination. Combination allow to use
# single char zero or more times.
import hashlib
import itertools
possibleChars = ['a', 'l', 'i', 'n', 's', 'b']
passLen = 7
#generate all pass combinations
combinations = []
for i in itertools.product(possibleChars, repeat=passLen):
combinations.append(''.join(map(str, i)))
hashes = []
for i in combinations:
hashedPass = hashlib.sha256(i.lower()).hexdigest()
hashes.append(hashedPass)
print i + "\t\t" + hashedPass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment