Skip to content

Instantly share code, notes, and snippets.

@Aaron1011
Created December 31, 2012 23:25
Show Gist options
  • Save Aaron1011/4423796 to your computer and use it in GitHub Desktop.
Save Aaron1011/4423796 to your computer and use it in GitHub Desktop.
Recursive password generator
def get_letters(letter, choices):
return [letter] + choices.get(letter, [])
def recurpassgen(password, passwords=[""], CHOICES={'a': ['@', '4'], 's': ['$', '&']}):
if password == "":
return passwords
passwords = [p + letter for p in passwords for letter in get_letters(password[0], CHOICES)]
return recurpassgen(password[1:], passwords=passwords)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment