This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
valithor's profile picture

Modem security

Started by valithor, 30 August 2015 - 03:42 AM
valithor #1
Posted 30 August 2015 - 05:42 AM
Been a while since I have posted a topic here :P/>

I am trying to find a way to create a secure connection between two computers using the modem api. I already have found a way using something similar to a Ceasar cipher to encrypt the message once the secure connection is made (trust me it is very very hard to crack), but I am having trouble finding a way to get the secure connection. What I need to create a secure connection is the ability to have some random number accessible on both computers. So far the only thing that I have found that would be unique between the two computers is the distance between the computers from the modem_message event. However, this would only be secure as long as someone else did not have a system set up to locate the position of computers, which they could use to find the distance between the two computers.

If anyone has any ideas of anything I could try to create a good random number that only two computers would have access to it would be appreciated.
Edited on 30 August 2015 - 03:44 AM
HPWebcamAble #2
Posted 30 August 2015 - 06:03 AM
This is a key-exchange proof-of-concept I wrote:
http://pastebin.com/PvbUbACi

To use in game:
1) Place down 2 computers (they shouldn't have to be advanced)
2) Place wireless modems on top of each computer
3) run the program on each

At the end of the program, they both will have the same 'shared' number, even though it is never explicitly transferred.

EDIT: It uses Diffie HellMan key exchange
Edited on 30 August 2015 - 04:48 AM
valithor #3
Posted 30 August 2015 - 06:10 AM
This is a key-exchange proof-of-concept I wrote:
http://pastebin.com/PvbUbACi

To use in game:
1) Place down 2 computers (they shouldn't have to be advanced)
2) Place wireless modems on top of each computer
3) run the program on each

At the end of the program, they both will have the same 'shared' number, even though it is never explicitly transferred.

The only problem is the return port is visible to all computers who receive the message, which would make it just as easy to crack. It is still an amazing concept though. :D/>/>

I really do doubt I will be able to find something that will work perfectly, and will have to settle for a imperfect solution
Edited on 30 August 2015 - 04:11 AM
HPWebcamAble #4
Posted 30 August 2015 - 06:27 AM
The only problem is the return port is visible to all computers who receive the message, which would make it just as easy to crack

Err, you mean the 'replyChannel'? It only broadcasts the computer's ID on with that, but it doesn't really matter if a computer lies about its ID, the calculations don't count on that.

If that's not it, please explain, I was under the impression that this is uncrackable without some fancy math
flaghacker #5
Posted 30 August 2015 - 06:42 AM
The wikipedia page about Diffie HellMan key exchange explains how to achieve a shared secret key. It even has some illustrations :)/>
valithor #6
Posted 30 August 2015 - 06:59 AM
The only problem is the return port is visible to all computers who receive the message, which would make it just as easy to crack

Err, you mean the 'replyChannel'? It only broadcasts the computer's ID on with that, but it doesn't really matter if a computer lies about its ID, the calculations don't count on that.

If that's not it, please explain, I was under the impression that this is uncrackable without some fancy math

Yes I meant replyChannel. I guess that is what I get for skimming the code (read line 41 as p3 instead of p4[3]). I thought I saw it using the replyChannel when generating the shared number. However, I did get a very interesting result when I was testing it on 4 different computers. I edited the code on 2 computers, where it wouldn't send the first message on them, and ran 1 unedited the 2 edited and then the other unedited one. The result that I thought was interesting was not only were there only 2 that were ever the same, but also it wasn't consistently the 2 unedited ones that were the same.

Visual example: 1 and 2 are unedited, while 3 and 4 are (I always ran the 2 edited ones between the unedited ones)

1 = 2
1 = 3
1 = 4
2 = 3
2 = 4

It was always one of those combinations, with the first one usually the outcome.

The wikipedia page about Diffie HellMan key exchange explains how to achieve a shared secret key. It even has some illustrations :)/>/>/>/>

Thanks i will go check it out
Edited on 30 August 2015 - 05:02 AM