Advertisement
imk0tter

Imk0tter

Nov 17th, 2010
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. import sys,getopt,string,random
  2.  
  3. def makehash(inp,charset=string.digits + string.ascii_letters):
  4.     out = 0;
  5.     for x in inp:
  6.         out *= len(charset) + 1
  7.         try:
  8.             out += charset.index(x) + 1
  9.         except:
  10.             pass
  11.     return hex(out)
  12.  
  13. def makestring(inp, charset=string.digits + string.ascii_letters):
  14.     inp = int(inp,16)
  15.     out = ''
  16.     while inp > 0:
  17.         y = inp % (len(charset) + 1)
  18.         if y > 0:
  19.             out = charset[y - 1] + out
  20.         else:
  21.             out = ' ' + out;
  22.         inp = (inp - y) / (len(charset) + 1)
  23.     return out
  24.    
  25. def strip(str,char):
  26.     out = ''
  27.     for c in str:
  28.         if c != char:
  29.             out += c
  30.     return out
  31.    
  32. def makecharset(inp):
  33.     out = ''
  34.     while len(inp) > 0:
  35.         rem = inp[int(random.random() * (len(inp)) - .01)]
  36.         out += rem
  37.         inp = strip(inp,rem)
  38.     return out
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement