summaryrefslogblamecommitdiffstats
path: root/gen_password.py
blob: 19b778197e6bdb109c71f100b0a991ce94b2fa81 (plain) (tree)
1
2
3
4
5
6





                                                                                    
import base64, cracklib, sha, string, os

# 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(sha.new(password).digest()).rstrip('\n')