asymetrical encryption/decryption?

Request a new command, feature, or improvement

Moderator: MSandro

Post Reply
MSandro
Posts: 156
Joined: Jul 26th, '17, 21:12

asymetrical encryption/decryption?

Post by MSandro » Aug 12th, '18, 21:20

Does GP featrue an asymetrical cryptosystem? If not it would be nice if something like RSA rould be implemented.

User avatar
Calloway
Posts: 63
Joined: Apr 30th, '18, 00:28
Location: Eastern United States

Re: asymetrical encryption/decryption?

Post by Calloway » Aug 14th, '18, 17:04

I think you could just add this in a project with blocks because right now GP supports hashing, SHA256, and encoding for multiple things.

MSandro
Posts: 156
Joined: Jul 26th, '17, 21:12

Re: asymetrical encryption/decryption?

Post by MSandro » Aug 15th, '18, 11:44

Hmm, I am able to use asymetrical cryptosystems (generating private and public keys tor transfer data over networks between my Python projects) but I am not an expert, so I don't know how souch system works in detail. I am not sure if souch hashing tools like sha256 are enoght to build my own asymetrical encryption and decryption system. But I'll try to experiment a bit more with those functionalities already buildin GP.

Gosha
Posts: 14
Joined: Mar 29th, '17, 15:26

Re: asymetrical encryption/decryption?

Post by Gosha » Aug 24th, '18, 15:49

Hi, I have tried working with asymmetrical encryption in GP with limited success. The biggest problem that I ran into was that there is a limit to how large integers are allowed to be in GP (1073741823 is the largest allowed integer).

MSandro
Posts: 156
Joined: Jul 26th, '17, 21:12

Re: asymetrical encryption/decryption?

Post by MSandro » Aug 24th, '18, 17:19

Gosha wrote:
Aug 24th, '18, 15:49
Hi, I have tried working with asymmetrical encryption in GP with limited success. The biggest problem that I ran into was that there is a limit to how large integers are allowed to be in GP (1073741823 is the largest allowed integer).
Interessting, yes the integers are not that big. But could you upload your sucess try as an project please? I wasn't sucess yet to something simular, I know how to use several asymetrical entryption-tools but I don't exactly know how those cryptosystems works.

User avatar
Calloway
Posts: 63
Joined: Apr 30th, '18, 00:28
Location: Eastern United States

Re: asymetrical encryption/decryption?

Post by Calloway » Aug 24th, '18, 17:25

Is there no big math in GP?

SimpleSi
Posts: 327
Joined: Jul 2nd, '17, 13:47

Re: asymetrical encryption/decryption?

Post by SimpleSi » Aug 27th, '18, 21:33

Is there no big math in GP?
There is a little bit of support (addition of big numbers)

I had a go at trying to add multiplication in a earlier beta but it wasn't at all optimised for speed so would be too slow

Simon

JohnM
Posts: 364
Joined: Sep 11th, '15, 14:42

Re: asymetrical encryption/decryption?

Post by JohnM » Sep 1st, '18, 17:01

As Gosha pointed out, the RSA encryption system involves multiplying and taking the modulus of very large numbers (500-1000 decimal digits). If you have a system that supports working with such large integers, then RSA isn't too difficult to implement. As I recall, the most difficult part is generating a key pair, which involves finding large prime numbers. But one could use a Linux command line tool to generate the key pair.

Unfortunately, GP does not currently have a large integer class. So, an interesting subproblem is to create such a class that supports basic arithmetic (+, -, *, and /) and printing large integers. When I was working on the Squeak project, I implemented such a package, and it was actually sort of interesting. You use the same algorithms for addition, subtraction, multiplication, and division that you learned back in elementary school, but typically use a large base like 256 rather than base 10 so you can process more bits with each of the processor's multiple/divide instructions. I used this book as my guide:

https://www.amazon.com/Art-Computer-Pro ... 0201896842

But Wikipedia articles might also be a good reference, if anyone wants to take this on. Strange as it may sound, implementing arithmetic that works for arbitrarily large integers is actually fun!

Post Reply