Skip to content

Instantly share code, notes, and snippets.

@typhonius
Created October 29, 2013 11:08
Show Gist options
  • Save typhonius/7212680 to your computer and use it in GitHub Desktop.
Save typhonius/7212680 to your computer and use it in GitHub Desktop.
Super simple password hashing on the command line.
#!/bin/bash
SALT=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-10};echo;`
PW=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-18};echo;`
HASH=`openssl passwd -1 -salt $SALT $PW`
echo "Automatically generated password of $PW salted against $SALT gets hashed as $HASH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment