diff options
author | root <root@dev.spline.de> | 2009-12-16 15:58:25 +0100 |
---|---|---|
committer | root <root@dev.spline.de> | 2009-12-16 15:58:25 +0100 |
commit | acc5ec0d9b7496fdf36b88ed111b8b32ac50a497 (patch) | |
tree | 282873d577bd5e79a2718fbd3c1bd1143838c97b /bin | |
parent | 3871df7aff5940d7d8ea436fe95e03d0dc05178c (diff) | |
download | dev-scripts-acc5ec0d9b7496fdf36b88ed111b8b32ac50a497.tar.gz dev-scripts-acc5ec0d9b7496fdf36b88ed111b8b32ac50a497.tar.xz dev-scripts-acc5ec0d9b7496fdf36b88ed111b8b32ac50a497.zip |
add simple helper to generate hahsed passwords
Diffstat (limited to '')
-rwxr-xr-x | bin/gen_password | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/gen_password b/bin/gen_password new file mode 100755 index 0000000..81cb802 --- /dev/null +++ b/bin/gen_password @@ -0,0 +1,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]) |