MD5.md5 in RubyGems

moriqe$B$G$9!#e(B

e$B<!$N$h$&$Ke(B RubyGems e$B$Ge(B require ‘md5’ e$B$r;H$C$F$$$k$N$Ge(B
ruby-1.8.6 e$B$K>e$2$k$H$&$^$/$$$+$J$/$J$j$=$&$G$9!#e(B

rubygems-0.9.2/lib/rubygems/validator.rb:

##
# Given a gem file's contents, validates against its own MD5 

checksum
# gem_data:: [String] Contents of the gem file
def verify_gem(gem_data)
if(gem_data.size == 0) then
raise VerificationError.new(“Empty Gem file”)
end
require ‘md5’
unless(gem_data =~ /MD5SUM/m)
return # Don’t worry about it…this sucks. Need to fix MD5
stuff for
# new format
# FIXME
end
unless (MD5.md5(gem_data.gsub(/MD5SUM = “([a-z0-9]+)”/, “MD5SUM =
“” + (“F” * 32) + “””)) == $1.to_s)
raise VerificationError.new(“Invalid checksum for Gem file”)
end
end

e$B<!$NBP1~$rDs0F$7$^$9!#e(B

— ext/digest/lib/md5.rb Tue Feb 13 08:01:19 2007
+++ ext/digest/lib/md5.rb.new Tue Mar 6 17:21:53 2007
@@ -9,6 +9,6 @@

class MD5
def self.md5(*args)

  • new(*args)
  • new.update(*args)
    end
    end

At Tue, 6 Mar 2007 17:37:28 +0900,
Kazuhiro Y. wrote:

moriqです。

次のように RubyGems で require ‘md5’ を使っているので
ruby-1.8.6 に上げるとうまくいかなくなりそうです。
(snip)
end
end

確かに。ナイスキャッチ感謝します。


/
/__ __ Akinori.org / MUSHA.org
/ ) ) ) ) / FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ / ( (__( @ iDaemons.org / and.or.jp

“Different eyes see different things,
Different hearts beat on different strings –
But there are times for you and me when all such things agree”

At Tue, 6 Mar 2007 18:14:46 +0900,
I wrote:

At Tue, 6 Mar 2007 17:37:28 +0900,
Kazuhiro Y. wrote:

moriqです。

次のように RubyGems で require ‘md5’ を使っているので
ruby-1.8.6 に上げるとうまくいかなくなりそうです。
(snip)
次の対応を提案します。

 MD5.new(“str”) も動くようにしました。new を置き換えてしまうので、
MD5 は Digest::MD5 を指すのではなくサブクラスにしました。

 また、 sha1 ã«ã‚‚åŒæ§˜ã®å¤‰æ›´ã‚’åŠ ãˆã¾ã—ãŸã€‚


/
/__ __ Akinori.org / MUSHA.org
/ ) ) ) ) / FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ / ( (__( @ iDaemons.org / and.or.jp

“Different eyes see different things,
Different hearts beat on different strings –
But there are times for you and me when all such things agree”

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs