# MD5.md5 in RubyGems

**URL:** <https://www.ruby-forum.com/t/md5-md5-in-rubygems/87833>\
**Category:** Development\
**Created:** [March 6, 2007, 9:38am UTC](https://www.ruby-forum.com/t/md5-md5-in-rubygems/87833 "2007-03-06T09:38:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kazuhiro\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/35a633/32.png) [@Kazuhiro\_Y](https://www.ruby-forum.com/u/Kazuhiro_Y)\
**Post date:** [March 6, 2007, 9:38am UTC](https://www.ruby-forum.com/t/md5-md5-in-rubygems/87833/1 "2007-03-06T09:38:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kazuhiro\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/35a633/32.png) [@Kazuhiro\_Y](https://www.ruby-forum.com/u/Kazuhiro_Y)\
**Post date:** [March 6, 2007, 10:16am UTC](https://www.ruby-forum.com/t/md5-md5-in-rubygems/87833/2 "2007-03-06T10:16:10Z")

</div>

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](http://Akinori.org) / [MUSHA.org](http://MUSHA.org)  
/ ) ) ) ) / [FreeBSD.org](http://FreeBSD.org) / [Ruby-lang.org](http://Ruby-lang.org)  
Akinori MUSHA aka / (\_ / ( (\_\_( @ [iDaemons.org](http://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”

---

<div class="post-metadata">

**Author:** ![Kazuhiro\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/35a633/32.png) [@Kazuhiro\_Y](https://www.ruby-forum.com/u/Kazuhiro_Y)\
**Post date:** [March 6, 2007, 11:17am UTC](https://www.ruby-forum.com/t/md5-md5-in-rubygems/87833/3 "2007-03-06T11:17:22Z")

</div>

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](http://Akinori.org) / [MUSHA.org](http://MUSHA.org)  
/ ) ) ) ) / [FreeBSD.org](http://FreeBSD.org) / [Ruby-lang.org](http://Ruby-lang.org)  
Akinori MUSHA aka / (\_ / ( (\_\_( @ [iDaemons.org](http://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”
