From owner-freebsd-current@FreeBSD.ORG Thu Jan 8 13:49:16 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5BD4106564A for ; Thu, 8 Jan 2009 13:49:16 +0000 (UTC) (envelope-from david@catwhisker.org) Received: from albert.catwhisker.org (adsl-63-193-123-122.dsl.snfc21.pacbell.net [63.193.123.122]) by mx1.freebsd.org (Postfix) with ESMTP id B6ACE8FC16 for ; Thu, 8 Jan 2009 13:49:16 +0000 (UTC) (envelope-from david@catwhisker.org) Received: from albert.catwhisker.org (localhost [127.0.0.1]) by albert.catwhisker.org (8.14.3/8.14.3) with ESMTP id n08DM20Q084728; Thu, 8 Jan 2009 05:22:02 -0800 (PST) (envelope-from david@albert.catwhisker.org) Received: (from david@localhost) by albert.catwhisker.org (8.14.3/8.14.3/Submit) id n08DM2EK084727; Thu, 8 Jan 2009 05:22:02 -0800 (PST) (envelope-from david) Date: Thu, 8 Jan 2009 05:22:02 -0800 From: David Wolfskill To: Damien Fleuriot Message-ID: <20090108132202.GD64787@albert.catwhisker.org> References: <57dc0bd10901080437y5f745b4ckf40b48a9d9d55ce8@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Ruyc9IU5x/hZJuxv" Content-Disposition: inline In-Reply-To: <57dc0bd10901080437y5f745b4ckf40b48a9d9d55ce8@mail.gmail.com> User-Agent: Mutt/1.4.2.3i Cc: freebsd-current@freebsd.org Subject: Re: Bug or unwanted behaviour in echo ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jan 2009 13:49:17 -0000 --Ruyc9IU5x/hZJuxv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 08, 2009 at 01:37:06PM +0100, Damien Fleuriot wrote: > ... > I was toying around with a site that proposed to hash passwords to > MD5, and comparing results with my host running FreeBSD 7.0-STABLE >=20 > At some point I didn't get the same hash from the website and from BSD. >=20 > On BSD: > echo -n "test'$@" | md5 > 5c28a8c6d799d302f3ef53afefdfc81b >=20 > On website: > f883cdacbb478c241c51da1f67fbe9bf >=20 > After swapping characters around I realized that echo just interprets > $@ (which in our case is null). Errr... no, I think you will find that what echo saw was actually a string whose md5 hash was "5c28a8c6d799d302f3ef53afefdfc81b". The "$@" was seen as a token by the shell, its value interpolated, and passed along to echo (which may well have been a shell builtin in any case, depending on what shell you were using). That's what escaping the "$" worked. > ...=20 Peace, david --=20 David H. Wolfskill david@catwhisker.org Depriving a girl or boy of an opportunity for education is evil. See http://www.catwhisker.org/~david/publickey.gpg for my public key. --Ruyc9IU5x/hZJuxv Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkll/fkACgkQmprOCmdXAD3qSgCghhyCVHC95+6T1i06PqJXfL9D iO4AmgKDJDu7rrOJoqwY8nN9yV6NcXex =QvE5 -----END PGP SIGNATURE----- --Ruyc9IU5x/hZJuxv--