From: Eric Hodel Date: 2003-02-05T02:57:35+09:00 Subject: Re: SHA1 hash on OS X incorrect --JP+T4n/bALQSJXh8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Richard Kilmer (rich@infoether.com) wrote: > I was just stunned by the fact that the SHA1 hash in Ruby on OS X=20 > (Jaguar) produces incorrect results. >=20 > I use SHA1 in the jabber4r (Ruby Jabber) library for digest=20 > authentication. This effectively prevents jabber4r from working on the= =20 > stock Ruby that ships with OS X. >=20 > test.rb... > require 'digest/sha1' > puts Digest::SHA1.new("test").hexdigest >=20 > And then a few tests: >=20 > /usr/bin/ruby -v > ruby 1.6.7 (2002-03-01) [powerpc-darwin6.0] > /usr/bin/ruby test.rb > 94266438e06c02e522256b64ed8c833aef0270d0 > ^ ^ ^ > This number is incorrect. > Under 1.6.7 on Win32 and Linux it produces the correct result. >=20 > /usr/local/bin/ruby -v > ruby 1.8.0 (2003-01-31) [powerpc-darwin6.3] > /usr/local/bin/ruby test.rb > a94a8fe5ccb19ba61c4c0873d391e987982fbbd3 > ^ ^ ^ > This is correct. >=20 > Anyone want to corroborate? $ ruby -v ruby 1.6.8 (2002-12-24) [i386-freebsd4] $ ruby -r digest/sha1 -e 'puts Digest::SHA1.new("test").hexdigest' a94a8fe5ccb19ba61c4c0873d391e987982fbbd3 $ ruby18 -v ruby 1.8.0 (2003-01-11) [i386-freebsd4] $ ruby18 -r digest/sha1 -e 'puts Digest::SHA1.new("test").hexdigest' a94a8fe5ccb19ba61c4c0873d391e987982fbbd3 $ uname -a FreeBSD uriel.jijo.segment7.net 4.7-STABLE FreeBSD 4.7-STABLE #2: Wed Jan 22 18:02:24 PST 2003 root@uriel.jijo.segment7.net:/usr/obj/disks/src/stable/sys/URIEL i386 --=20 Eric Hodel - drbrain@segment7.net - http://segment7.net All messages signed with fingerprint: FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --JP+T4n/bALQSJXh8 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (FreeBSD) iD8DBQE+P/8MMypVHHlsnwQRArimAJ4xRv2ZrDgiS+3kG2oOaNo0CbfnogCg19Eu KLcneyUWSONt4tLlLu/4TxQ= =ldd5 -----END PGP SIGNATURE----- --JP+T4n/bALQSJXh8--