19 lines
420 B
Python
Executable File
19 lines
420 B
Python
Executable File
#!/usr/bin/python
|
|
#
|
|
# Input: String via Environment-Variable "string_to_hash"
|
|
# Output: STDOUT: Passwort Hash (bcrypt)
|
|
#
|
|
# 2. Juli 2016
|
|
# Joerg Lehmann, nbit Informatik GmbH
|
|
#
|
|
import bcrypt, os, sys
|
|
|
|
password = os.environ.get('string_to_hash')
|
|
if not password:
|
|
sys.exit()
|
|
|
|
# Hash a password for the first time, with a randomly-generated salt
|
|
hashed = bcrypt.hashpw(password, bcrypt.gensalt())
|
|
|
|
print "%s" % (hashed)
|