Forum: Ruby on Rails require 'digest/md5' not working on Mac or Windows

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Mark H. (Guest)
on 2006-02-19 05:56
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. (Guest)
on 2006-02-19 06:06
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
Craig W. (Guest)
on 2006-02-19 06:08
(Received via mailing list)
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
Craig W. (Guest)
on 2006-02-19 06:11
(Received via mailing list)
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
Roustem K. (Guest)
on 2006-02-19 06:23
(Received via mailing list)
On Sunday, February 19, 2006, at 4:56 AM, Mark H. wrote:
>--
>Posted via http://www.ruby-forum.com/.
>_______________________________________________
>Rails mailing list
>removed_email_address@domain.invalid
>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.
Eric H. (Guest)
on 2006-02-19 09:22
(Received via mailing list)
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. - removed_email_address@domain.invalid - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
Eric H. (Guest)
on 2006-02-19 09:28
(Received via mailing list)
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. - removed_email_address@domain.invalid - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
David M. (Guest)
on 2006-02-19 09:52
(Received via mailing list)
Try
require 'md5'

It's in a different directory on one of my systems...

Regards

Dave M.
Eric H. (Guest)
on 2006-02-20 00:02
(Received via mailing list)
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. - removed_email_address@domain.invalid - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
This topic is locked and can not be replied to.