[前][次][番号順一覧][スレッド一覧]

ruby-changes:18008

From: yugui <ko1@a...>
Date: Thu, 2 Dec 2010 17:06:15 +0900 (JST)
Subject: [ruby-changes:18008] Ruby:r30028 (ruby_1_9_2): merges r29407 from trunk into ruby_1_9_2.

yugui	2010-12-02 17:05:48 +0900 (Thu, 02 Dec 2010)

  New Revision: 30028

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30028

  Log:
    merges r29407 from trunk into ruby_1_9_2.
    --
    * ext/openssl/lib/openssl/bn.rb (Integer#to_bn): OpenSSL::BN.new
      accepts only Strings, so call Integer#to_s(16).
      16 is for an optimization. [ruby-dev:42336]

  Modified files:
    branches/ruby_1_9_2/ChangeLog
    branches/ruby_1_9_2/ext/openssl/lib/openssl/bn.rb
    branches/ruby_1_9_2/test/openssl/test_bn.rb
    branches/ruby_1_9_2/version.h

Index: ruby_1_9_2/ChangeLog
===================================================================
--- ruby_1_9_2/ChangeLog	(revision 30027)
+++ ruby_1_9_2/ChangeLog	(revision 30028)
@@ -1,3 +1,9 @@
+Mon Oct  4 09:30:42 2010  NARUSE, Yui  <naruse@r...>
+
+	* ext/openssl/lib/openssl/bn.rb (Integer#to_bn): OpenSSL::BN.new
+	  accepts only Strings, so call Integer#to_s(16).
+	  16 is for an optimization. [ruby-dev:42336]
+
 Mon Oct  4 07:57:51 2010  NARUSE, Yui  <naruse@r...>
 
 	* cont.c (fiber_memsize): Return size.
Index: ruby_1_9_2/ext/openssl/lib/openssl/bn.rb
===================================================================
--- ruby_1_9_2/ext/openssl/lib/openssl/bn.rb	(revision 30027)
+++ ruby_1_9_2/ext/openssl/lib/openssl/bn.rb	(revision 30028)
@@ -29,7 +29,7 @@
 #
 class Integer
   def to_bn
-    OpenSSL::BN::new(self)
+    OpenSSL::BN::new(self.to_s(16), 16)
   end
 end # Integer
 
Index: ruby_1_9_2/version.h
===================================================================
--- ruby_1_9_2/version.h	(revision 30027)
+++ ruby_1_9_2/version.h	(revision 30028)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.2"
-#define RUBY_PATCHLEVEL 58
+#define RUBY_PATCHLEVEL 59
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 9
 #define RUBY_VERSION_TEENY 1
Index: ruby_1_9_2/test/openssl/test_bn.rb
===================================================================
--- ruby_1_9_2/test/openssl/test_bn.rb	(revision 30027)
+++ ruby_1_9_2/test/openssl/test_bn.rb	(revision 30028)
@@ -8,6 +8,11 @@
 if defined?(OpenSSL)
 
 class OpenSSL::TestBN < Test::Unit::TestCase
+  def test_integer_to_bn
+    assert_equal(999.to_bn, OpenSSL::BN.new(999.to_s(16), 16))
+    assert_equal((2 ** 107 - 1).to_bn, OpenSSL::BN.new((2 ** 107 - 1).to_s(16), 16))
+  end
+
   def test_prime_p
     OpenSSL::BN.new((2 ** 107 - 1).to_s(16), 16).prime?
     OpenSSL::BN.new((2 ** 127 - 1).to_s(16), 16).prime?(1)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]