Saturday, October 28, 2006

Automatic Password Generator

To be really safe, one should have a different password for every online service. You can never be sure whether the service you're using is storing your password porperly. It's not easy to remember a password for every site, so many people use a password manager that stores all your passwords.

Here's another way to do it. This shell script reads in a URL and Password, then calculates the sha1 sum of the concatenation of the url, password and the url again.

#!/usr/bin/bash

# Default Options
length=8
method="md5"

# Turn off echo to read url and password
if ! stty -echo; then
    printf "Could not turn echo off.\n"
    exit 1
fi

printf "URL: "
read -r url
printf "\n"
printf "Password: "
read -r password
printf "\n"

# Turn echoing back on
stty echo

printf "$url$password$url" | sha1sum

Note how the terminal echo is turned off for the URL and password entry.

The resulting sha1 sum could be used by you to generate a password and will always be the same as long as you enter the same URL and password.

0 Comments:

Post a Comment

<< Home