Require 'digest/md5' not working on Mac or Windows

I’ve tried the following line in ruby script/console

require ‘digest/md5’

Both my Mac (Intel iMac) and my Windows box return “false”… Any ideas
what could be wrong? I was trying to do the RoR Recipe on page 54 of
Chad F.'s new (beta) book.

-Mark

Mark H. wrote:

require ‘digest/md5’

Just make a note, I am aware I can just use SHA1 very easily instead,
I’m just curious why MD5 doesn’t work.

-Mark

On Sun, 2006-02-19 at 04:56 +0100, Mark H. wrote:

I’ve tried the following line in ruby script/console

require ‘digest/md5’

Both my Mac (Intel iMac) and my Windows box return “false”… Any ideas
what could be wrong? I was trying to do the RoR Recipe on page 54 of
Chad F.'s new (beta) book.


I had that problem too…I think you could probably just substitute sha1
for md5

digest/md5

and elsewhere SHA1 for MD5

Craig

On Sunday, February 19, 2006, at 4:56 AM, Mark H. wrote:


Posted via http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

I saw ‘ext/digest/md5’ in ruby 1.8.2 sources.
You can try to build and install md5 from the source.

Best Regards, Roustem.

On Sun, 2006-02-19 at 04:56 +0100, Mark H. wrote:

I’ve tried the following line in ruby script/console

require ‘digest/md5’

Both my Mac (Intel iMac) and my Windows box return “false”… Any ideas
what could be wrong? I was trying to do the RoR Recipe on page 54 of
Chad F.'s new (beta) book.


and for what it’s worth…I thought that particular recipe was
‘half-baked’ since it offered not even the slightest example of view
code that you could use to make that work and I spent too much time
grappling with it and abandoned it for another time.

Craig

On Feb 18, 2006, at 11:19 PM, Eric H. wrote:

Nothing is wrong.

$ ruby
p require ‘digest/md5’
-:1: warning: parenthesize argument(s) for future version
p require ‘digest/md5’
-:2: warning: parenthesize argument(s) for future version
true
false

I suppose I should also mention:

$ ruby
require ‘no such file’
-:1:in `require’: no such file to load – no such file (LoadError)
from -:1


Eric H. - [email protected] - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com

Try
require ‘md5’

It’s in a different directory on one of my systems…

Regards

Dave M.

On Feb 18, 2006, at 11:51 PM, David M. wrote:

ideas
-:2: warning: parenthesize argument(s) for future version
Try
require ‘md5’

It’s in a different directory on one of my systems…

No, you need to read more carefully.

Try:
$ ri require
--------------------------------------------------------- Kernel#require
require(string) => true or false

  Ruby tries to load the library named _string_, returning +true+ if
  successful. If the filename does not resolve to an absolute path,
  it will be searched for in the directories listed in +$:+. If the
  file has the extension ``.rb'', it is loaded as a source file; if
  the extension is ``.so'', ``.o'', or ``.dll'', or whatever the
  default shared library extension is on the current platform, Ruby
  loads the shared library as a Ruby extension. Otherwise, Ruby

tries
adding .rb'', .so’‘, and so on to the name. The name of the
loaded feature is added to the array in +$“+. A feature will
not be
loaded if it’s name already appears in +$”+. However, the file
name
is not converted to an absolute path, so that ``+require
‘a’;require ‘./a’+’’ will load +a.rb+ twice.

     require "my-library.rb"
     require "db-driver"

require returns false if the file is already loaded.


Eric H. - [email protected] - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com

On Feb 18, 2006, at 7:56 PM, Mark H. wrote:

I’ve tried the following line in ruby script/console

require ‘digest/md5’

Both my Mac (Intel iMac) and my Windows box return “false”… Any
ideas
what could be wrong? I was trying to do the RoR Recipe on page 54 of
Chad F.'s new (beta) book.

Nothing is wrong.

$ ruby
p require ‘digest/md5’
-:1: warning: parenthesize argument(s) for future version
p require ‘digest/md5’
-:2: warning: parenthesize argument(s) for future version
true
false


Eric H. - [email protected] - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com