View Full Version : Quick and easy random password generator
ardchoille
July 3rd, 2006, 04:06 PM
I wrote this script in response to a user needing to generate quick random passwords.
#!/bin/bash
# This script creates a random password using sha1sum
echo "Enter the master password"
read -s MASTPASS
echo "Enter the reason"
read -s REASON
echo "Enter desired number of characters"
read -s DESNUM
echo
echo "Your random password is:"
echo $MASTPASS $REASON | sha1sum | cut -c1-$DESNUM
echo
As long as the MASTPASS stays the same, you can have hundreds of REASON replacements (eg. website, newuser, email, tarballpassword, etc) and only have to memorise the master password.
I hope someone finds it helpful :)
ardchoille
July 4th, 2006, 09:21 AM
Did a bit of improving on the original:
#!/bin/bash
# This script creates a random password using sha1sum
MASTONE=x
MASTTWO=y
while [ $MASTONE != $MASTTWO ] ; do
echo "Enter the master password"
read -s MASTONE
echo "Retype the master password"
read -s MASTTWO
if [ $MASTONE != $MASTTWO ] ; then
echo "Password entries don't match, try again" 1>&2
fi
done
echo "Enter the reason"
read -s REASON
echo "Enter desired number of characters"
read -s DESNUM
echo
echo "Your random password is:"
echo $MASTONE $REASON | sha1sum | cut -c1-$DESNUM
echo
maagimies
July 6th, 2006, 02:54 PM
Thanx, this is great :)
gorilla_king
July 6th, 2006, 06:11 PM
so i'm really new to this kind of stuff. mainly all i do is browse the web.
so how do i run this. and if i make a file for it, what should the extension be? thank you.
henrikem
July 6th, 2006, 06:23 PM
so i'm really new to this kind of stuff. mainly all i do is browse the web.
so how do i run this. and if i make a file for it, what should the extension be? thank you.
Since it is a bash script, i would use .sh.
gorilla_king
July 6th, 2006, 10:22 PM
Since it is a bash script, i would use .sh.
lol, thanks you
Roderik
July 7th, 2006, 02:20 AM
[EDIT] ow only read half the post, sorry :) this just makes random passwords :)
pwgen takes care of all your password generating needs :)
roderik@alucius ~ $ sudo apt-get install pwgen
roderik@alucius ~ $ pwgen
Lepi1een hahF2ahv IuYohch4 avi8AiB7 Jeo4ogho Deidee9a chah5Jah pee1Aiji
yohG4ai4 Shee4aic Owaa1bup Seixe3Ju Hi2okoph Cunee4Ee ooquuv7M ahH4yahn
aZ4oophi aevooS8Y za9ahNga Ki8ieduo Hei7eip4 eehee3Ie pe6Ugh5I eeThieD9
ook2Eeyu ahmaiD7G ii5ouHae Aethai7v Quei7uta shohS0oh Eghei3ui Uochee8a
Peeshei3 Tiezee6Y cuki0taR gubeeF6a ToeF0ey7 joo2Iedi Aevee0pe aigh4Iel
airoh0Bu AechieV6 xoo7aXai Yai9ohre yaed4ooS Som3Goh4 aexai5Ch meiree8E
bee3eWie iesheiN1 xei4An8e dahb7Shu ohD8Aiy4 aiNu4aec elueC7oh aet2Sha0
thei9Xir ooja4Yea lei3goCh Eiquah2a Fia8fius aiG5yee2 AhphieR4 ItheeL5i
Caegahp9 wahCh4Vu vohxa8Ch aiButh6M ieX8eeBa eeYoo5sh jahGe0Qu suug0Cha
ucuaCha6 Quu8iepa Mobae9qu sis0ahPh oe6Eepee na9Eithu shoogh0A chie6Nan
chee8EeM ooxoo1Sa uNiuthe6 Ier6eeDe ahy7Oqu7 Quu3jaed Ies7Hei4 shae8auS
oothuCi2 Shoh8eiK Oosh7Quo chei8Xoo photh4Ae iex8ea3I Oogie5ie ohP6yieh
oofo2aNg Sish1aiW och1Obie beuNg7To cee4iPah Pie3ahma jeThoos9 noh8Ohx4
Wohduip8 thu9ohLo Iwai5pou rei9ooGh Aiyeigh2 ahsh6aiB ovooj4Ix eaj5Eizu
Yae8cho9 meijie1Z aiK4bool OoDiwo5m Aivoan0c Wui0ahp7 Ogu3Muiy Ucah7Auz
Bii0Aich USh1dige UKo9Thab ohZ9Ahsu puY8youT roh5Ai4o Lair6rei dieB7AhK
aeShei5u uCh9erei aiHait1g sienie1X geefai2I ahrae7Ah ohb2Fahj Pa3aeph0
ucee5AeW maiX0di8 aeLoh1oj ahvohX6w Iek5ieno Oj0ahZee UGheeph0 Ciec5aev
Diesha4o kaeGah9U AePhai3u fohZae9c oiK0aec1 Cei9xied Thah0hoh laaMah2S
hom8Aepi aish6Euv Eenie0ae AeS4ooso AeFooX3I Ef6JohSh IeG4lool Aeng9cah
gorilla_king
July 7th, 2006, 03:24 AM
i posted this on my site without even thinking. and i forgot to ask your permission. well, i'm using your script as a reference for others on how to make little scripts like that run. mainly because i was confused, so i thought others might be too. so i was wondering if i can have permission to use this small script on my very unpopular (and until, never mentioned to anyone) site. If you'd like to preview what it will look like and actually exaclty how it will be displayed. Go here http://whatigoogle.com/index.php?gt=pages&id=17
NoobieDoobieDo
March 4th, 2007, 05:51 AM
In the last line :
echo $MASTONE $REASON | sha1sum | cut -c1-$DESNUM
you could add
static=`date +%s`
echo $static $MASTONE $REASON | sha1sum | cut -c1-$DESNUM
This helps make it a bit more random IMHO.
madneon
February 7th, 2009, 05:59 AM
This helps make it a bit more random IMHO.
That breaks the idea of having the same password every time you enter same MASTPASS and REASON. [-X
vBulletin® v3.8.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.