From 623f789e46a571d4d18ba5a7ae5fd657e5d34a0f Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 22 Jun 2000 08:29:58 +0000 Subject: 2000-06-22 git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/extmk.rb.in | 30 ++++++++++++++++-------------- ext/md5/md5.txt | 11 +++++++++++ ext/md5/md5.txt.jp | 12 ++++++++++++ 3 files changed, 39 insertions(+), 14 deletions(-) (limited to 'ext') diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in index c97f86a68..272a508e0 100644 --- a/ext/extmk.rb.in +++ b/ext/extmk.rb.in @@ -218,28 +218,30 @@ SRC return true end -def have_func(func) +def have_func(func, header=nil) libs = $libs - - if /mswin32|mingw/ =~ RUBY_PLATFORM - r = try_link(<<"SRC", libs) + src = + if /mswin32|mingw/ =~ RUBY_PLATFORM + r = <<"SRC" #include #include +SRC + else + "" + end + unless header.nil? + src << <<"SRC" +#include <#{header}> +SRC + end + r = try_link(src + <<"SRC", libs) int main() { return 0; } int t() { #{func}(); return 0; } SRC - unless r - r = try_link(<<"SRC", libs) -#include -#include + unless r + r = try_link(src + <<"SRC", libs) int main() { return 0; } int t() { void ((*p)()); p = (void ((*)()))#{func}; return 0; } -SRC - end - else - r = try_link(<<"SRC", libs) -int main() { return 0; } -int t() { #{func}(); return 0; } SRC end unless r diff --git a/ext/md5/md5.txt b/ext/md5/md5.txt index 0eca7c902..e2b072401 100644 --- a/ext/md5/md5.txt +++ b/ext/md5/md5.txt @@ -25,6 +25,17 @@ Methods: returns have value of the added strings as a 16 bytes string. + hexdigest + + returns have value of the added strings as an 32 bytes ASCII + string. This method is equal to: + + def hexdigest + ret = '' + digest.each_byte {|i| ret << sprintf('%02x', i) } + ret + end + update(str) Update the MD5 object with the string. Repeated calls are diff --git a/ext/md5/md5.txt.jp b/ext/md5/md5.txt.jp index a1451f117..04cf32908 100644 --- a/ext/md5/md5.txt.jp +++ b/ext/md5/md5.txt.jp @@ -26,6 +26,18 @@ Methods: 今までに追加した文字列に対するハッシュ値を16バイト長の文字列で 返す. + hexdigest + + 今までに追加した文字列に対するハッシュ値を、ASCIIコードを使って + 16進数の列を示す'fe5c2235f48d2bcc911afabea23cd5aa'のような32文字 + の文字列にエンコードして返す。Rubyで書くと以下と同じ。 + + def hexdigest + ret = '' + digest.each_byte {|i| ret << sprintf('%02x', i) } + ret + end + update(str) MD5オブジェクトに文字列を追加する。複数回updateを呼ぶことは文 -- cgit