Skip to content

Instantly share code, notes, and snippets.

@elasticdog
Last active December 21, 2015 21:18
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 elasticdog/6367040 to your computer and use it in GitHub Desktop.
Save elasticdog/6367040 to your computer and use it in GitHub Desktop.
shell function to generate user-specific passwords for cjdns
hypepass () {
if [[ -z $1 ]]; then
echo 'Usage: hypepass <USERNAME>'
echo 'Generate a user-specific password for allowing someone to peer with your cjdns host'
else
desired=64
random=$(tr -cd '[:alnum:]' < /dev/urandom | fold -w $(( ${desired} - ${#1} - 1 )) | head -n 1)
echo "{ \"user\": \"${1}\", \"password\": \"${1}:${random}\" }"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment