From: Chris Shea Date: 2007-03-30T14:20:12+09:00 Subject: Re: How to md5 a string? On Mar 29, 11:06 pm, Bontina Chen wrote: > Chris Shea wrote: > > On Mar 29, 9:13 pm, Bontina Chen wrote: > > >> -- > >> Posted viahttp://www.ruby-forum.com/. > > > It might be informative to see some examples what you're getting with > > Digest/MD5 vs other tools. I've used Digest/MD5 with great success on > > Windows. > > > If what you're doing is getting the MD5 of a file, opening it for > > reading in binary mode is done like so: > > > File.new('filename','rb') > > > Chris > > s="http://pandora.com" > Digest::MD5.hexdigest(s) > > Abon > > -- > Posted viahttp://www.ruby-forum.com/. C:\>ruby -v ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32] C:\>irb irb(main):001:0> require 'digest/md5' => true irb(main):002:0> s = "http://pandora.com" => "http://pandora.com" irb(main):003:0> Digest::MD5.hexdigest(s) => "9e565e1adf52310555fa2dc1391ded64" -- mvb:~ cms$ ruby -v ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.9.1] mvb:~ cms$ irb irb(main):001:0> require 'digest/md5' => true irb(main):002:0> s = "http://pandora.com" => "http://pandora.com" irb(main):003:0> Digest::MD5.hexdigest(s) => "9e565e1adf52310555fa2dc1391ded64" -- I get the same result from http://www.xs4all.nl/~jlpoutre/BoT/Javascript/Utils/md5_hashing.html Can you give a more detailed description of what you're experiencing? Chris