blob: 81cb8027ba3bdcfc9fe92a835e0cd7dc17de60bc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
|
#!/usr/bin/python
import base64, cracklib, string, os, sys
from hashlib import sha1
# generate a htpasswd compatible sha1 digest in base64 encoding
# see: http://httpd.apache.org/docs/2.2/misc/password_encryptions.html
def generate_sha_base64(password):
print "{SHA}" + base64.encodestring(sha1(password).digest()).rstrip('\n')
if __name__ == '__main__':
generate_sha_base64(sys.argv[1])
|