From owner-freebsd-questions@FreeBSD.ORG Wed Mar 3 12:44:48 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4319B1065670 for ; Wed, 3 Mar 2010 12:44:48 +0000 (UTC) (envelope-from freebsd-questions@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id F1A308FC12 for ; Wed, 3 Mar 2010 12:44:47 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1NmnwT-0001sF-US for freebsd-questions@freebsd.org; Wed, 03 Mar 2010 13:44:45 +0100 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 03 Mar 2010 13:44:45 +0100 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 03 Mar 2010 13:44:45 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-questions@freebsd.org From: Ivan Voras Date: Wed, 03 Mar 2010 13:44:36 +0100 Lines: 39 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.5) Gecko/20100118 Thunderbird/3.0 In-Reply-To: Subject: Re: Did something in the hashes change from 6 to 8? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Mar 2010 12:44:48 -0000 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.