ruby:1494
From: "Leonard Chin" <l.g.chin@g...>
Date: Tue, 6 Mar 2007 10:06:53 +0900
Subject: [ruby:1494] Re: Ruby 1.8.6 preview 3 公開
レオと申します。 > 鈴木と申します。 > なんだかちゃんと伝わるのか心許ないのですが、たたき台に。 他に貢献できるところがないので、翻訳してみました。 Here's a translation, if it isn't too late. - None of the modules in RAA or Rubyforge that deal with message_digest appear to be using the ext/digest interface. Despite having interfaces similar to OpenSSL::Digest, the implementations are not shared. In other words, there were problems with the reusability of the original implementation-side API. With this in mind, the implementation-side APIs have undergone a major overhaul, while mostly maintaining the user-side interface.The C API has been improved, and a Ruby API has been newly added. - In order to handle algorithms with parameters, the constructor has been opened up to subclasses. As a result, modules which specify an algorithm (as in OpenSSL::Digest), specify the bit length (SHA2 etc)., can be implemented as subclasses of Digest(::Class). On the downside, a degree of compatibility has been lost. Although we wanted to maintain backwards compatibility, but the changes were applied because greater importance is placed on compatibility with 1.9 and onwards. Furthermore, there weren't many examples of "new" being used with parameters, and it would be comparatively easy to identify and rewrite such cases. Here's how it can be rewritten: - Digest::MD5.new(str).hexdigest and similar usages are just (too) verbose. Digest::MD5.hexdigest(str) is good enough/sufficent (this apples to .to_s and .digest as well) - In the cases of usages such as: md = Digest::MD5.new(str) please rewrite it like this: md = Digest::MD5.new.update(str) An implementation of Tiger and Whirlpool using the new implementation API can be found at the following URL: http://rubyforge.org/viewvc/?root=digest That the above can now be distributed independently can be seen as the fruit of this set of changes, since they were originally hard to build standalone without the sourcecode of Ruby itself. (Unless their usage becomes widespread, there is no intention of adding them to the standard distribution) -- ML: ruby@m... 使い方: http://QuickML.com/
1490 2007-03-05 07:22 [maki@r... ] Ruby 1.8.6 preview 3 公開 1491 2007-03-05 07:30 ┗[maki@r... ] 1492 2007-03-05 10:09 ┗[suzk@o... ] 1493 2007-03-05 14:25 ┣[maili31s@c... ] 英訳 (Re: Ruby 1.8.6 preview 3 公開) -> 1494 2007-03-06 02:06 ┗[l.g.chin@g... ] 1496 2007-03-07 09:50 ┗[maki@r... ]