From 64566f7585feaebbb6396b8e7be05c52e15f10ae Mon Sep 17 00:00:00 2001 From: mollusk Date: Mon, 11 Jul 2016 04:21:59 -0700 Subject: [PATCH] [New Script]: bashpass: Generates a random password using sha256 and custom length --- bashpass.sh | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100755 bashpass.sh diff --git a/bashpass.sh b/bashpass.sh new file mode 100755 index 0000000..2ed7a62 --- /dev/null +++ b/bashpass.sh @@ -0,0 +1,87 @@ +#!/bin/bash + + +## Functions +shaStatic(){ +#hashes date with SHA + local charSize=20 + echo + echo "${charSize} character password generated using SHA256 with date" + echo "***************************************************" + date +%s | sha256sum | base64 | head -c ${charSize} ; echo + echo "***************************************************" +} + +shaWithNum(){ + #hashes date with SHA + if [ $1 -ge 255 ];then + echo + echo "Error : $0 : Please choose a number lower than 255" + echo + + else + echo + echo "$1 character password generated using SHA256 with date" + echo "***************************************************" + date +%s | sha256sum | base64 | head -c $1 ; echo + echo "***************************************************" + fi +} + + +leftHand(){ + echo + echo "8 character password easy to type with left hand" + echo "**************************************************" + ] [-l] [-lcs ]" + echo + echo "-cs | --char-size " + echo " specify password length" + echo + echo "-l | --left-hand" + echo " left handed password" + echo + echo "-lcs | --left-char-size " + echo " left hand password with length" + echo + ;; +esac