Digest::MD5 on Mac OS X

Hello-

I recently started using Ruby on Mac OS X, and I’ve noticed a small
problem. The version of Ruby that comes with OS X 10.2 seems to have
Digest::MD5 compiled incorrectly. I’m not 100% certain of this, but I
know that its computing different values for an MD5 than both OpenSSL’s
MD5 command, and the command line utility ported from FreeBSD. This is,
obviously, a problem. I’m probably going to investigate recompiling
Ruby to see if this solves the problem, but since I’m working on a
project that I hope to distribute more widely than just for me, I’m
thinking I need a better solution.

Has anybody created a pure Ruby implementation of Digest::MD5? I figure
this would be the easiest way to go, as it would work on any box that
has Ruby installed. Is this worth the trouble? Or does somebody have a
better idea?

Any input is appreciated.

Cheers,

bs.

Yeah…I found the same problem with Digest::SHA1 on OS X. I don’t
quite know why but the hashing stuff is screwed up. I use SHA hashing
in my Jabber4r library for digest authentication, and so for me to not
be able to use it was a show stopper. I ended up download and building
the source from cvs (for Ruby 1.8). The hash stuff in Ruby works great
and cross-platform…I really don’t know what the Apple guys did to
screw this up.

-rich

···

On Wednesday, March 19, 2003, at 11:08 AM, Ben Schumacher wrote:

Hello-

I recently started using Ruby on Mac OS X, and I’ve noticed a small
problem. The version of Ruby that comes with OS X 10.2 seems to have
Digest::MD5 compiled incorrectly. I’m not 100% certain of this, but I
know that its computing different values for an MD5 than both
OpenSSL’s MD5 command, and the command line utility ported from
FreeBSD. This is, obviously, a problem. I’m probably going to
investigate recompiling Ruby to see if this solves the problem, but
since I’m working on a project that I hope to distribute more widely
than just for me, I’m thinking I need a better solution.

Has anybody created a pure Ruby implementation of Digest::MD5? I
figure this would be the easiest way to go, as it would work on any
box that has Ruby installed. Is this worth the trouble? Or does
somebody have a better idea?

Any input is appreciated.

Cheers,

bs.

If I was a betting man (which I am), I'd bet that it has something to do with endianess. I'm just not sure why the Apple folks (of all people) who have made that mistake.

The only problem I have with rolling my own Ruby is that it won't help anybody that might just download my software. (I'm working with RubyCocoa, so its going to be pretty much OS X specific, anyhow.)

Cheers,

bs.

···

On Wednesday, March 19, 2003, at 09:24 AM, Richard Kilmer wrote:

Yeah...I found the same problem with Digest::SHA1 on OS X. I don't quite know why but the hashing stuff is screwed up. I use SHA hashing in my Jabber4r library for digest authentication, and so for me to not be able to use it was a show stopper. I ended up download and building the source from cvs (for Ruby 1.8). The hash stuff in Ruby works great and cross-platform...I really don't know what the Apple guys did to screw this up.

-rich

On Wednesday, March 19, 2003, at 11:08 AM, Ben Schumacher wrote:

Hello-

I recently started using Ruby on Mac OS X, and I've noticed a small problem. The version of Ruby that comes with OS X 10.2 seems to have Digest::MD5 compiled incorrectly. I'm not 100% certain of this, but I know that its computing different values for an MD5 than both OpenSSL's MD5 command, and the command line utility ported from FreeBSD. This is, obviously, a problem. I'm probably going to investigate recompiling Ruby to see if this solves the problem, but since I'm working on a project that I hope to distribute more widely than just for me, I'm thinking I need a better solution.

Has anybody created a pure Ruby implementation of Digest::MD5? I figure this would be the easiest way to go, as it would work on any box that has Ruby installed. Is this worth the trouble? Or does somebody have a better idea?

Any input is appreciated.

Cheers,

bs.

I am using RubyCocoa as well. You could always include an updated digest.bundle with your application that works under the installed (1.6.7) Ruby. I think that could be built (although, like I said, I have switched to 1.8).

-rich

···

On Wednesday, March 19, 2003, at 11:58 AM, Ben Schumacher wrote:

If I was a betting man (which I am), I'd bet that it has something to do with endianess. I'm just not sure why the Apple folks (of all people) who have made that mistake.

The only problem I have with rolling my own Ruby is that it won't help anybody that might just download my software. (I'm working with RubyCocoa, so its going to be pretty much OS X specific, anyhow.)

Cheers,

bs.

On Wednesday, March 19, 2003, at 09:24 AM, Richard Kilmer wrote:

Yeah...I found the same problem with Digest::SHA1 on OS X. I don't quite know why but the hashing stuff is screwed up. I use SHA hashing in my Jabber4r library for digest authentication, and so for me to not be able to use it was a show stopper. I ended up download and building the source from cvs (for Ruby 1.8). The hash stuff in Ruby works great and cross-platform...I really don't know what the Apple guys did to screw this up.

-rich

On Wednesday, March 19, 2003, at 11:08 AM, Ben Schumacher wrote:

Hello-

I recently started using Ruby on Mac OS X, and I've noticed a small problem. The version of Ruby that comes with OS X 10.2 seems to have Digest::MD5 compiled incorrectly. I'm not 100% certain of this, but I know that its computing different values for an MD5 than both OpenSSL's MD5 command, and the command line utility ported from FreeBSD. This is, obviously, a problem. I'm probably going to investigate recompiling Ruby to see if this solves the problem, but since I'm working on a project that I hope to distribute more widely than just for me, I'm thinking I need a better solution.

Has anybody created a pure Ruby implementation of Digest::MD5? I figure this would be the easiest way to go, as it would work on any box that has Ruby installed. Is this worth the trouble? Or does somebody have a better idea?

Any input is appreciated.

Cheers,

bs.

That’s funny because I just discovered a very serious (well, according
to me) bug in apple’s gcc when compiling code doing byte swapping in
tight loops with optimisations on (you can find my detailed post about
it on the darwin-development mailing list).

I wonder if this could be related in some ways…

···

Ben Schumacher ben@blahr.com wrote:

If I was a betting man (which I am), I’d bet that it has something to
do with endianess.


Luc Heinrich - lucsky@mac.com

Hi,

I have just moved over to using 1.8 and on a previously working script
I now get

@field = getField (line)
warning: don’t put space before argument parentheses

but later on
out << “some string”.gsub (/[\s\n]*$/, “”)
^
(under the first /)
syntax error (SyntaxError)

Removing the space gets rid of the syntax error or changing the <<
operator to a += give a warning.

I personally like to have the space before an argument parenthesis, but
it seems odd that in one place it deserves a warning and in others it
gets an error.

Dave.

Hi,

···

In message “ruby 1.8 space before argument parenthesis” on 03/10/15, Dave Baldwin dave.baldwin@3dlabs.com writes:

I personally like to have the space before an argument parenthesis, but
it seems odd that in one place it deserves a warning and in others it
gets an error.

It’s caused by limitation of yacc parser generator (and my brain).
Please stand, and don’t put spaces before argument parentheses, please.

						matz.