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>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] 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 > > At some point I didn't get the same hash from the website and from BSD. > > On BSD: > echo -n "test'$@" | md5 > 5c28a8c6d799d302f3ef53afefdfc81b > > On website: > f883cdacbb478c241c51da1f67fbe9bf > > 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. > ... Peace, david -- 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. [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkll/fkACgkQmprOCmdXAD3qSgCghhyCVHC95+6T1i06PqJXfL9D iO4AmgKDJDu7rrOJoqwY8nN9yV6NcXex =QvE5 -----END PGP SIGNATURE-----help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090108132202.GD64787>
