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

AsymmetricEncryption

Started by Microwarrior, 25 May 2015 - 02:37 AM
Microwarrior #1
Posted 25 May 2015 - 04:37 AM
Does anyone know where I can find some good computercraft asymmetric encryption?
SquidDev #2
Posted 25 May 2015 - 08:33 AM
Sadly asymmetric encryption generally requires lots of processing power and large numbers. Sadly ComputerCraft provides neither of these. The closest you can get is using KillaVanilla's 'Secure Rednet tunnels' which implements the Diffie-Helman keyexchange behind the scenes.

It might be possible to adapt this script to use inbuilt ComputerCraft libraries. By the looks of it it would require a SHA1 implementation, the bit library and KillaVanilla's (again) BigInt library. By the looks of it the Sha1 comes with built in bit operators so you might want to replace those with the bit.* operators instead - but remember that ComputerCraft can only do bit operations on numbers up to 2^32 and then kinda glitch out.
Edited on 25 May 2015 - 06:34 AM
Anavrins #3
Posted 25 May 2015 - 05:21 PM
Unfortunately, assymetric encryption is impossible to do efficiently in CC due to small numbers.

I've made proof of concept of both
D-H
and RSA
D-H is possible, but small numbers makes it trivial to break, RSA can only generate a key pair of around 46-bits, encryption and decryption are off the charts.

There is however a peripheral in Immibis' peripherals called the Cryptographic Accelerator which enable RSA with 1024-Bits.
Edited on 25 May 2015 - 03:22 PM
Creator #4
Posted 25 May 2015 - 06:05 PM
Technically it is possible, but the processing power CC has is simply not enough. However, I think that D-H should be possible even with small numbers because tha lack of processing power that does not allow D-H to be used with big numbers also makes breaking difficult.
Microwarrior #5
Posted 26 May 2015 - 03:36 AM
Thanks for the response! I think ill use the D-H Key Exchange and a symmetric encryption API.