Created
March 20, 2019 22:56
-
-
Save isaactzab/e1d3baca80dd5714bee23a559a13ef4e to your computer and use it in GitHub Desktop.
Generate passwords / hash from string / random string - Terminal OSX (with some adjusments will you run in linux)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# usage: | |
# 1- First argument: String seed | |
# 2- Second argument: Hash length | |
# $hashify "my string seed" 10 | |
LENGTH_STRING=${2:-8} | |
SEED_STRING=$1 | |
md5 <<< ${SEED_STRING} | base64 | awk -v lenstr="$LENGTH_STRING" '{print substr ($0, 10, lenstr)}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
LC_ALL=C tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' </dev/urandom | head -c 13 ; echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment