Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. def sortCharset(set):
  2.   _set = ""
  3.   for c in set:
  4.     if c not in _set:
  5.       _set += c
  6.   set = _set
  7.   del _set
  8.   set = list(set)
  9.   set.sort()
  10.   return "".join(set)
  11.  
  12.  
  13. def stringForInt(num, set, length):
  14.   setLen = len(set)
  15.   string = ""
  16.   string += set[num % setLen]
  17.   for n in xrange(1,length):
  18.     num //= setLen
  19.     string += set[num % setLen]
  20.   return string
  21.  
  22.  
  23. def bruteforce(set, length, raw = False):
  24.   if raw is False:
  25.     set = sortCharset(set)
  26.  
  27.   for n in xrange(len(set) ** length):
  28.     yield stringForInt(n, set, length)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement