From 106595827ad33295d2f5bd1c1255c87293215a54 Mon Sep 17 00:00:00 2001 From: naruse Date: Thu, 4 Apr 2013 02:35:07 +0000 Subject: * ext/openssl/ossl_bn.c (ossl_bn_to_i): Use bn2hex to speed up. In general, binary to/from decimal needs extra cost. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/openssl/ossl_bn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/openssl/ossl_bn.c') diff --git a/ext/openssl/ossl_bn.c b/ext/openssl/ossl_bn.c index 822b854efe..1038135ae8 100644 --- a/ext/openssl/ossl_bn.c +++ b/ext/openssl/ossl_bn.c @@ -226,10 +226,10 @@ ossl_bn_to_i(VALUE self) GetBN(self, bn); - if (!(txt = BN_bn2dec(bn))) { + if (!(txt = BN_bn2hex(bn))) { ossl_raise(eBNError, NULL); } - num = rb_cstr_to_inum(txt, 10, Qtrue); + num = rb_cstr_to_inum(txt, 16, Qtrue); OPENSSL_free(txt); return num; -- cgit v1.2.3