Playing with RSA

Hi everybody!

I always wondered about that magic
2022-02-20 22_27_35-McNeel Forum
that make us browse safe. (the day it fails… oh boy!)
Public key, private key, prime numbers, etc etc…
How can a content encrypted with one key be decrypted only with the other key?!?
Really counter-intuitive!

So I’ve tried to study it and understand it: I failed! :rofl: This stuff is too much abstract for me!

… but I have a working definition that will be interesting to share, i hope.
Everything is based on RSA (cryptosystem) - Wikipedia and other linked pages.



RSA mini V0.1.gh (23.5 KB)

There are clearly HUGE limitations by the use of 32-bit integers, so factorizing the modulus of the public key is just too easy. This is just a simple code to test/play with …


Try to decrypt this message (or signature) with a public key: n=8633 e=35

encrypted data (click here)

2937
8499
928
1680
18
1552
607
3419
1680
1428
4496
3442

Factorizing is not necessary here.


Or, trying to simulate the interception of a message sent from client to server, where the server’s public key is n=36031 e=123 , crack this:

encrypted data (click here)

22938
25490
23735
17483
12590
30097
30131
21003
25490
17483
31108
10090
8894
25490
21003
3300
25490
14285
8894
26719
2608
1731
28395
21003
25490
8486
21003
25490
31293
29234

Factorizing here is needed… and in real life scenario it would take too much computation time (… we all hope)


… that’s it. Just messing around. :laughing:
I’m not sure if I’ll dive further into this.
Please, if anyone can correct anything I’ve done/wrote, do it!
Also, if you have anything interesting to add here, i’m curious about it!

2 Likes

This wonderful guy introduced me to cryptography over Ethereum and it’s the most exciting thing I’ve found after Grasshopper. At some point he explained asymmetric cryptography. It gave me some understanding of blockchain and motivated me to start learning crypto-asset programming (smart contracts). I haven’t played much with their platform, but I think I’m going to give it another chance now that I have more experience. :slight_smile: I highly recommend this series.

1 Like