| 71 | == Generating passwords on Windows == |
| 72 | |
| 73 | If you don't have Apache availabel, you can use this Python script to generate your passwords (code borrowed heavily from #845): |
| 74 | |
| 75 | {{{ |
| 76 | from optparse import OptionParser |
| 77 | import md5 |
| 78 | |
| 79 | # build the options |
| 80 | usage = "usage: %prog [options]" |
| 81 | parser = OptionParser(usage=usage) |
| 82 | parser.add_option("-u", "--username",action="store", dest="username", type = "string", |
| 83 | help="the username for whom to generate a password") |
| 84 | parser.add_option("-p", "--password",action="store", dest="password", type = "string", |
| 85 | help="the password to use") |
| 86 | (options, args) = parser.parse_args() |
| 87 | |
| 88 | # check options |
| 89 | if (options.username is None) or (options.password is None): |
| 90 | parser.error("You must supply both the username and password") |
| 91 | |
| 92 | # Generate the string to enter into the htdigest file |
| 93 | realm = 'trac' |
| 94 | kd = lambda x: md5.md5(':'.join(x)).hexdigest() |
| 95 | print ':'.join((options.username, realm, kd([options.username, realm, options.password]))) |
| 96 | }}} |