summaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_bn.c
diff options
context:
space:
mode:
authornaruse <naruse@ruby-lang.org>2013-04-04 02:35:07 +0000
committernaruse <naruse@ruby-lang.org>2013-04-04 02:35:07 +0000
commit55da1c1701175ffa3d10f599fe4185eaa9cbf6e7 (patch)
treeaf82e104784d8ae6ecf478c1f10379ff42374a34 /ext/openssl/ossl_bn.c
parent7140430b522a3a38ba0c5155df7114f60853d11c (diff)
downloadruby-openssl-history-55da1c1701175ffa3d10f599fe4185eaa9cbf6e7.tar.gz
* 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
Diffstat (limited to 'ext/openssl/ossl_bn.c')
-rw-r--r--ext/openssl/ossl_bn.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/openssl/ossl_bn.c b/ext/openssl/ossl_bn.c
index 822b854..1038135 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;