summaryrefslogtreecommitdiff
path: root/ssha_password.py
diff options
context:
space:
mode:
authorroot <root@ip-172-31-44-20.us-west-2.compute.internal>2015-12-13 18:00:56 -0800
committerroot <root@ip-172-31-44-20.us-west-2.compute.internal>2015-12-13 18:00:56 -0800
commitbe794d825cff203f3ca943eba7b2e37de9b60b56 (patch)
tree798d864bf82257db923574c5ebb68bf5056649e4 /ssha_password.py
downloadserver_bin-be794d825cff203f3ca943eba7b2e37de9b60b56.tar.bz2
server_bin-be794d825cff203f3ca943eba7b2e37de9b60b56.tar.xz
server_bin-be794d825cff203f3ca943eba7b2e37de9b60b56.zip
Initial import
Diffstat (limited to 'ssha_password.py')
-rwxr-xr-xssha_password.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/ssha_password.py b/ssha_password.py
new file mode 100755
index 0000000..adfde45
--- /dev/null
+++ b/ssha_password.py
@@ -0,0 +1,19 @@
1#!/usr/bin/env python
2
3import hashlib
4import os
5
6
7def make_secret(password):
8 salt = os.urandom(4)
9
10 sha = hashlib.sha1(password)
11 sha.update(salt)
12
13 digest_salt_b64 = '{}{}'.format(sha.digest(), salt).encode('base64').strip()
14
15 return '{{SSHA}}{}'.format(digest_salt_b64)
16
17
18if __name__ == '__main__':
19 print make_secret("")