Requirements:
- 256 bits of entropy from a trusted source: macOS
- Replaces some characters from SET1 with those specified
- Snags the first 32 characters
I've stored this script /usr/local/bin/gen-passwd
man pages for
Requirements:
I've stored this script /usr/local/bin/gen-passwd
man pages for
| #!/usr/bin/env bash | |
| # PURPOSE: Generate a strong password with: | |
| # * 256 bits of entropy from a trusted source: macOS | |
| # * Replaces some characters from SET1 with those specified | |
| # * Snags the first 32 characters | |
| # ----------------------------------------------------------------------------- | |
| # EXECUTE: gen-passwd | |
| # ----------------------------------------------------------------------------- | |
| # AUTHOR: todd-dsm (github) | |
| # ----------------------------------------------------------------------------- | |
| #set -x | |
| ###---------------------------------------------------------------------------- | |
| ### VARIABLES | |
| ###---------------------------------------------------------------------------- | |
| # ENV Stuff | |
| ###---------------------------------------------------------------------------- | |
| ### FUNCTIONS | |
| ###---------------------------------------------------------------------------- | |
| function pMsg() { | |
| theMessage="$1" | |
| printf '\n%s\n\n' "$theMessage" | |
| } | |
| ###---------------------------------------------------------------------------- | |
| ### MAIN PROGRAM | |
| ###---------------------------------------------------------------------------- | |
| ### Generate a strong password | |
| ###--- | |
| pMsg "Your strong 32-character password:" | |
| openssl rand 256 | tr -dc 'A-Za-z0-9!@#$%^&*()_+-=[]{}|;:,.<>/?' | head -c 32 | |
| pMsg '' | |
| ###--- | |
| ### fin~ | |
| ###--- | |
| exit 0 |