Author Topic: Virus to crack RSA for nspire? :P  (Read 61393 times)

0 Members and 1 Guest are viewing this topic.

Offline TC01

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 344
  • Rating: +9/-0
    • View Profile
Re: Virus to crack RSA for nspire? :P
« Reply #60 on: July 01, 2010, 06:09:54 pm »
I was thinking: if we used ndless, could we ever access the area of the memory to change the factor required? We could make our own rsa key and replace ti's (making a key takes like 3 seconds)

I really don't know much about this, but I don't think TI would make it that easy on us.  If that was the case, I would think that the same thing would have been done to get the keys for all of the other calcs.
Back before the keys were cracked, BrandonW released some programs for Z80 calcs (73 and 83+) that patch the certificate to allow this; one gets the 83+ to accept community-signed OSes, and one gets the 73 to accept community-signed apps.

http://www.ticalc.org/archives/files/fileinfo/420/42048.html
http://brandonw.net/calcstuff/free73.zip

And there's also a program called FlashAppy that does the same thing for 68k calcs, it gets them to accept community-signed flash apps.

http://www.ticalc.org/archives/files/fileinfo/413/41328.html

So it's probably not impossible for the Nspire.



The userbars in my sig are links embedded links.

And in addition to calculator (and Python!) stuff, I mod Civilization 4 (frequently with Python).

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Virus to crack RSA for nspire? :P
« Reply #61 on: July 01, 2010, 06:25:32 pm »
Yeah I remember that, it came out only a day or two before FloppusMaximus announced he factored a key on United-TI. It was a major revolution when BrandonW released this, even thought it was quickly obsoleted ;D
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Tribal

  • The Fallen
  • LV5 Advanced (Next: 300)
  • *
  • Posts: 218
  • Rating: +15/-1
    • View Profile
Re: Virus to crack RSA for nspire? :P
« Reply #62 on: July 02, 2010, 01:10:18 am »
I had been working on a project for this and have a successful C++ port of the perl code on hackspire, which checks keys around 3x faster(based on the C++ version taking around 2m for 5000000 numbers and the perl script taking around 6m). Although, my network programming experience is near to none, and it might be awhile until I can get a server/client interface set up :/

If anybody would be interested, I can see what I can do about just packaging up the factoring part of the program along with the source code and putting it up somewhere. This incomplete version of the program would allow you to start at a position of your choosing(instead of getting this information automatically from the server like the full version will) and will be able to save/load your work upon exiting and re-opening.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Virus to crack RSA for nspire? :P
« Reply #63 on: July 02, 2010, 02:42:12 am »
I'm glad to hear this, I've been checking the discussion on and off in #omnimaga/OmnomIRC in the past two days. I wish you good luck for the networked version. I would love to help factoring that key.
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Tribal

  • The Fallen
  • LV5 Advanced (Next: 300)
  • *
  • Posts: 218
  • Rating: +15/-1
    • View Profile
Re: Virus to crack RSA for nspire? :P
« Reply #64 on: July 02, 2010, 10:46:59 pm »
As per a few people's request, I've attached the source code of just the factoring part of the program. I will be putting up a LSFR-randomized version in a bit if I can get it working(thanks to debrouxl for sending me the perl script since hackspire is temporarily down, and also for suggesting on making it). And hopefully debrouxl will be on soon to help me if I can't figure out the problem I'm having :-X

EDIT: Added a non-functioning LFSR version as cspire_lsfr.zip. Can someone check it out and see what I'm doing wrong?
« Last Edit: November 13, 2010, 07:42:40 pm by Tribal »

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Virus to crack RSA for nspire? :P
« Reply #65 on: July 03, 2010, 10:16:07 am »
Well, I don't know what your exact problem was, but the "0x" in "mpz_init_set_str(tap, "0xa48...");" was definitely a problem :)
(I got myself bit too several days ago by the exact same problem, in Java :D).


I'm attaching a new version of the C(++) LFSR-based program. It's much faster than the Perl script indeed, I thought the overhead of Perl would be lower. The LFSR is seeded with the current time; for better seeding, on POSIX platforms, we could use gettimeofday().
Some performance analysis using Valgrind on my Core 2 reveals that:
* it's much faster to mindlessly divide by all odd integers than to use any form of primality testing. And we can do slightly better than mindlessly dividing, by adding several trial divisions by the smallest primes;
* mpz_divisible_p is slightly faster than mpz_mod + mpz_cmp_si.

Enjoy :)

NOTE1: you probably want to rate-limit the program's output further, e.g. write data every 1048576 iterations rather than every 65536 iterations :D
NOTE2: for best results, compile GMP yourself from the sources (`./configure --prefix=$PREFIX --enable-cxx; make; make check; make install`): GMP tailors itself to your processor architecture, which results in a noticeable speedup for me, compared to stock Debian x86_64 binaries.

[EDIT: attaching a new version, with resuming support and automatic "0x" removal.]
« Last Edit: July 03, 2010, 12:51:39 pm by Lionel Debroux »
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: Virus to crack RSA for nspire? :P
« Reply #66 on: July 03, 2010, 01:14:43 pm »
Quote
I was thinking: if we used ndless, could we ever access the area of the memory to change the factor required? We could make our own rsa key and replace ti's (making a key takes like 3 seconds)

I think I read somewhere on hackspire that the factors were stored in read-only memory.

BTW, how do you show who a quote was from?

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Virus to crack RSA for nspire? :P
« Reply #67 on: July 03, 2010, 01:36:59 pm »
[q u o t e=<poster name>]...[/q u o t e]
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline Tribal

  • The Fallen
  • LV5 Advanced (Next: 300)
  • *
  • Posts: 218
  • Rating: +15/-1
    • View Profile
Re: Virus to crack RSA for nspire? :P
« Reply #68 on: July 03, 2010, 03:41:05 pm »
Isn't a uint64_t just a 'unsigned long long int'?

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Virus to crack RSA for nspire? :P
« Reply #69 on: July 03, 2010, 03:48:42 pm »
With GCC, I'd say yes. With compilers that don't support 'long long', no :)
(well, MSVC doesn't embed stdint.h, unless you're using the 2010 version. I don't know whether that one supports 'long long')
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Virus to crack RSA for nspire? :P
« Reply #70 on: July 07, 2010, 03:25:12 pm »
My computers have now performed a bit more than 10^12 trial divisions on 0xaba7... unsurprisingly, they did not find a factor :D
I'll switch them to TF on 0xc3b3 by the end of the week, and will stop TF attempts when both numbers have received roughly the same number of attempts (somewhere between 1e12 and 2e12). Doing more than this would not be reasonable.

Whatever we do, we collectively can't reasonably make more than somewhere between 10^14 and 10^20 TF attempts, but we'd need ~10^155 >> the estimated number of atoms in the universe (~10^100) >> 10^20.
« Last Edit: July 07, 2010, 03:26:11 pm by Lionel Debroux »
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Virus to crack RSA for nspire? :P
« Reply #71 on: July 07, 2010, 03:27:50 pm »
I don't know what any of that stuff means, being a TI-BASIC/Axe coder mostly, but good luck on this project :P
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: Virus to crack RSA for nspire? :P
« Reply #72 on: July 07, 2010, 03:44:23 pm »
Which is why trial division is not a good way to factor it.  It is the easiest method, though.  I wonder how much distributed computing would add to that.  How long has it been running?

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Virus to crack RSA for nspire? :P
« Reply #73 on: July 07, 2010, 03:55:06 pm »
We don't have access to the only practical method (or rather, the only not-completely-impractical method) for factoring 1024-bit integers.

My 4 cores (4-year-old models, Core 2 Duo T7200 & T7600) perform between 10^6 and 2*10^6 per second each, which translates to <250K seconds (~3 days full-time) for 10^12 operations. Even if we used a million equivalent computers for a year (which is wildly unrealistic), we wouldn't reach much above 10^20 operations, hence my figure above.
TF-ing these keys is no different in principle from playing at the lottery - the odds are extremely lower, but no money (my computers are loaded 100% with grid computing anyway, this is just a different kind of load) is involved.
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: Virus to crack RSA for nspire? :P
« Reply #74 on: July 07, 2010, 06:01:13 pm »
I second Lionel Debroux's opinions on this idea.
Seriously, your time, CPU cycles, and electricity are better spent on something worthwhile than on trial-factoring a 1024-bit number.
What is the "only practical method"? I thought the GNFS was currently the fastest algorithm for factoring large integers with no special form.