4 usage: %(progname)s [args] 8 import os, sys, string, time, getopt
17 salt = chr(random.randint(65,122)) + chr(random.randint(65,122))
18 pwhash = crypt.crypt(password,salt)
22 new_pw_hash = crypt.crypt(password,pw_hash[:2])
23 if new_pw_hash != pw_hash:
24 warn(
"new_pw_hash", repr(new_pw_hash), repr(pw_hash))
32 n = (ord(c) >> 4) & 0xf
33 hexrep.append(hex(n)[-1])
35 hexrep.append(hex(n)[-1])
36 return ''.join(hexrep)
40 for n
in range(0, len(digest), 2):
41 a = chr(string.atoi(digest[n:n+2], 16))
43 return string.join(code,
'')
50 mpw = zlib.compress(password)
56 mpw = string.join(mpw,
'')
62 mpassword = list(mpassword)
64 mpassword = string.join(mpassword,
'')
68 password = zlib.decompress(mpassword)
76 print __doc__ % vars()
78 def main(argv, stdout, environ):
80 optlist, args = getopt.getopt(argv[1:],
"", [
"help",
"test",
"debug"])
86 for (field, val)
in optlist:
90 elif field ==
"--debug":
92 elif field ==
"--test":
100 if __name__ ==
"__main__":
101 main(sys.argv, sys.stdout, os.environ)
def mungePassword(password)
def decode_digest(digest)
def checkPassword(password, pw_hash)
def main(argv, stdout, environ)
def encode_digest(digest)
def cryptPassword(password)
def unmungePassword(mpassword)