Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time
executable file 23 lines (20 sloc) 522 Bytes
#!/usr/bin/env python3
import base64
import getpass
import hashlib
import json
import os
pw = getpass.getpass("enter your password: ")
pw_bytes = pw.encode("utf-8")
salt_bytes = os.urandom(8)
salt_b64 = base64.b64encode( salt_bytes )
pw_hash = hashlib.sha256( pw_bytes + salt_bytes ).digest()
pw_hash_b64 = base64.b64encode( pw_hash )
"password_hash_b64" : pw_hash_b64.decode("ascii"),
"password_salt_b64" : salt_b64.decode("ascii"),
indent=3, separators=(',', ' : ')