Did something in the hashes change from 6 to 8?

Ivan Voras ivoras at freebsd.org
Wed Mar 3 12:44:48 UTC 2010

On 03/02/10 16:48, Christian Baer wrote:
> Mellow greetings!
> On a box running FreeBSD 6.something (probably 6.4) the boot drive died.
> I had never bothered to update it to 7 or 8, since I was planning to
> build a new computer anyway. Since I hadn't done that yet and I still
> needed the work of this machine, I just put in a new drive and installed
> 8.0.
> The deal is that a script I restored from backup doesn't quite work as I
> think it should. This is the part that somehow causes problems:
>    !/bin/sh
>    stty -echo
>    read -p "Enter passphrase: " passphrase
>    stty echo
>    main=`echo "${passphrase}" | sha256 | cut -c 1-5`
>    if [ "${main}" != "ddfab" ]; then
>      echo "Wrong passphrase!"
>      exit
>    fi
> I have typed the password in question about a gazillion times, so I am
> pretty sure I got it right. But somehow the 'if' keeps kicking in.
> There are two possible reasons for this:
> 1. I have Alzheimer's.
> 2. Something about the way sha256(1) and/or digest(1) or one of the
>     other commands in the script react differenly than before.
> Maybe there is another reason that I just don't see?

sha256 and the like cannot change because they are standard algorithms 
and changing them would break a lot of things.

Something else must be the problem. Maybe previous versions got newlines 
in the $passphrase variable or something like that? You will need to 
check output of every step of the script separately.

More information about the freebsd-questions mailing list