Date: Thu, 8 Jan 2009 05:22:02 -0800 From: David Wolfskill <david@catwhisker.org> To: Damien Fleuriot <dam@c-mal.com> Cc: freebsd-current@freebsd.org Subject: Re: Bug or unwanted behaviour in echo ? Message-ID: <20090108132202.GD64787@albert.catwhisker.org> In-Reply-To: <57dc0bd10901080437y5f745b4ckf40b48a9d9d55ce8@mail.gmail.com> References: <57dc0bd10901080437y5f745b4ckf40b48a9d9d55ce8@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090108132202.GD64787>