Project

General

Profile

Feature #7783

Add support for sqrt of very large numbers

Added by Santiago Pastorino over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
[ruby-core:51849]

Description

Currently ...

irb(main):001:0> Math.sqrt(2**6456)
=> Infinity

I wanted to do something like this to show an example of how RSA could break RSA the public modulus N is generated incorrectly.

In Python you can do it using http://code.google.com/p/gmpy/
The issue is also described here http://webcache.googleusercontent.com/search?q=cache:on5z4JS3iUcJ:stackoverflow.com/questions/8226087/how-do-i-get-math-sqrt-to-return-a-bignum-and-not-a-float+&cd=3&hl=en&ct=clnk

History

#1 [ruby-core:51850] Updated by Santiago Pastorino over 3 years ago

/RSA the/when/

#2 [ruby-core:51851] Updated by Zachary Scott over 3 years ago

=begin
Hello Mr. Pastorino!

It seems to work when I use the mathn library, which implements sqrt(3)

(({irb(main):001:0> require 'mathn' #=> true}))

(({irb(main):002:0> Math.sqrt(2**6456) #=> 53067179215503898168575338070}))
=end

#3 [ruby-core:51853] Updated by Santiago Pastorino over 3 years ago

Hey zzak, had no idea about that. Thanks!
So we can close this one.

#4 [ruby-core:51854] Updated by Martin Bosslet over 3 years ago

  • Status changed from Open to Closed

Nice find, Zachary!

I happened to talk with Santiago about this. Closing...

Also available in: Atom PDF