Jump to content




RC4 Encryption API

api wireless networking

31 replies to this topic

#1 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 13 January 2013 - 09:18 PM

Hello CC Forums,

Just bringing you another API, it's the RC4 encryption algorithm re implemented for ComputerCraft, RC4 is a fast stream algorithm and is used in protocols like SSL and WEP.

Download Link: http://pastebin.com/rDUe5wGe

Spoiler

Each time you encrypt something, the internal state changes, so you have to decrypt the same amount of data as you encrypt for the sessions to stay in sync, Meaning that if you encrypt two messages, you need to decrypt both messages otherwise the decryption stream wont have the same key state as the encryption.

I'm not very good with documentation. So please just leave any comments here and I'll help the best I can. Thanks

#2 crazyguymgd

  • Members
  • 139 posts
  • LocationUSA

Posted 13 January 2013 - 11:09 PM

Sounds cool. I'll probably never use it but I always like seeing people do things like this :P

#3 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 14 January 2013 - 09:06 AM

Thanks :)
The API's I typically post don't seem to get a lot of attention as they're normally technical and only have cliche use. But this would be good for anyone making an OS or some networking software. It'd be good to see some real encryption being used by some of the CC devs. :)

#4 legaliceit

  • Members
  • 5 posts
  • LocationGermany

Posted 16 January 2013 - 08:12 AM

Line 64 : "}" missing.

#5 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 16 January 2013 - 08:15 AM

 legaliceit, on 16 January 2013 - 08:12 AM, said:

Line 64 : "}" missing.

Excellent spotting, not sure how that character got away. Thanks.
Link fixed.

#6 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 18 February 2013 - 07:30 PM

Oh noes, I'm grave digging :(

How did I not see this earlier! Gotta love search ;)

Just posting to say, 'tis awesome and needs to be used by people a lot more, and I'm gunna use it in my messenger program :)

#7 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 18 February 2013 - 07:31 PM

Thanks TOBIT :D
Yeah, it never really took off, Kinda just let it rot :)

#8 GravityScore

  • Members
  • 796 posts
  • LocationLand of Meh

Posted 18 February 2013 - 08:35 PM

YES! I wanted an RSA or RC algorithm to use to encrypt Rednet messages! :D

Mind if I use this to encrypt sent messages in Firewolf? :P

#9 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 18 February 2013 - 08:40 PM

 GravityScore, on 18 February 2013 - 08:35 PM, said:

YES! I wanted an RSA or RC algorithm to use to encrypt Rednet messages! :D
Well I guess it was a good thing I bumped it :P

EDIT: So tell me NeverCast. Is this KSA, PRGA, or some variant?

Edited by TheOriginalBIT, 18 February 2013 - 08:44 PM.


#10 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 18 February 2013 - 08:43 PM

This api is free to use :)
I'd love to see it actually in use :D
WOO!

#11 Jan

  • Members
  • 141 posts
  • Locationthe Netherlands

Posted 22 February 2013 - 12:37 AM

AFAIK, rednet doesn't support characters higher than 127 very well.

Would this still work if I replaced all '256' for '128' ?

#12 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 24 February 2013 - 10:40 PM

Yes that would work. I assume you're meaning with RedPower cables. Which are being retired from CC.

#13 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 24 February 2013 - 10:42 PM

 TheOriginalBIT, on 18 February 2013 - 08:40 PM, said:

So tell me NeverCast. Is this KSA, PRGA, or some variant?

Uhh.. They're both required for RC4. So both.

#14 ElvishJerricco

  • Members
  • 803 posts

Posted 27 February 2013 - 08:15 PM

I'll be honest Nevercast, your content is some of my favorite on the forums.

#15 Geforce Fan

  • Members
  • 846 posts
  • LocationMissouri, United States, America, Earth, Solar System, Milky Way, Universe 42B, Life Street, Multiverse, 4th Dimension

Posted 17 May 2013 - 10:14 PM

Umm, the commands don't work...

#16 UselessFlaw

  • Members
  • 4 posts

Posted 31 July 2013 - 08:02 PM

I just came across this and, I'm impressed. I hope you don't mind if I use this to add some encryption to my accounts API (credit to you of course)

Edit: oops I revived something ;)

#17 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 31 July 2013 - 08:06 PM

verry nice, you can increase the efficiency of the encryption and key generation alot though

#18 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 01 August 2013 - 02:13 PM

just realized, this lacks public / private asymmetric key generation, atm its just symmetric encryption though i dont see a good way to generate large primes :/
might be vulnerable to plaintext attacks, but its more secure than what ive got

sorry for doublepost, wanted to bump

#19 AgentE382

  • Members
  • 119 posts

Posted 09 August 2013 - 02:23 PM

RC4 is a symmetric stream cipher. The key generation / exchange is up to you.

Do yourself a favor and discard the first 256-4096 bytes. Information about the key can be derived from the first bytes of the keystream.

Also, if you use a salt in your key-exchange, XOR it with the key or hash them concatenated to get the final key. Don't concatenate them and directly use that as the cipher's input.

Or you could wait until tomorrow afternoon when I add a more secure RC4 variant to my version.

#20 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 09 August 2013 - 05:35 PM

 AgentE382, on 09 August 2013 - 02:23 PM, said:

RC4 is a symmetric stream cipher. The key generation / exchange is up to you.
o_O the topic was changed from RSA, derpy me





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users