Skip to content

Instantly share code, notes, and snippets.

@bl00m
Last active April 26, 2017 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bl00m/b2374e89d0657353ebb591733bee2066 to your computer and use it in GitHub Desktop.
Save bl00m/b2374e89d0657353ebb591733bee2066 to your computer and use it in GitHub Desktop.
Use scrypt to derive a password in a 24 chars string in base64
#!/usr/bin/env python
# Usage : pwgen.py [salt]
import scrypt
import getpass
import base64
import pyperclip
import time
import sys
salt = sys.argv[1] if len(sys.argv) > 1 else 'pdojoe44z67dhiahabdiz' # Change the default salt
pwd = getpass.getpass()
pyperclip.copy(str(base64.b64encode(scrypt.hash(pwd, salt)[:24]))[2:-1])
print('Clear clipboard in 10sec...')
time.sleep(10)
pyperclip.copy('')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment