The Hardware Side of Cryptography

15 June 2008

Implementing the RC4 stream cipher on PIC18F4550

Filed under: encryption — Tags: , , , , — edipermadi @ 12:29 pm

Today, i’m started developing RC4 cipher on PIC18F4550. This cipher was originally developed by Ron Rivest for RSA Security as a trade secret. Eventually, someone posted it to Cypherpunks and sci.crypt Mailing List. Now, RC4 belong to everyone who want to use it :) . You may note that the cipher was pretty simple and straightforward. However, since this cipher require large size of RAM for computation. I decided to write the code on PIC18F4550 instead of PIC16F877.

After sitting for more than six hours, finally i was able to code RC4 stream cipher for PIC18F4550. That was an enjoyful moment to me. The code was developed and simulated using MPLAB v8.0 and some PHP script to simulate encryption byte per byte, of course to ensure that everything is under control.

RC4 was the fastest cipher i have ever coded, it reach almost 25 cycles per byte 8) , That was amazing, 8) . See two screenshots below and feel free to use and modify the code under the term of GNU Public License v3.0. Have a nice day and happy coding :D .

Plain Text

Cipher Text

RELATED STUFF

Download:
Source Code v1.0
PIC18F4550 Datasheet
MPLAB v8.0

Reference:
RC4 Cipher
Ron Rivest
RSA Security

6 Comments »

  1. Do you have any script in C?

    Comment by Paul Hodel — 13 June 2009 @ 2:25 am

    • @Paul :
      hi, thank you for visiting my blog. I have the code in C. i’ll send it to your email.

      Comment by edipermadi — 15 June 2009 @ 10:26 am

  2. Do you have RC4 in C?
    i hope u send RC4 script(in C) to my email?
    i want to create a RC4 encrypt funtion in postgresql with C..
    thank u very much…

    Comment by pram — 16 June 2009 @ 10:33 pm

    • @pram :
      Hi, thank you for your visit to my blog. I sent the code to ur email.

      good luck

      Comment by edipermadi — 17 June 2009 @ 5:55 pm

  3. Please send me the C code.
    Thank you very much,

    Eduardo

    Comment by Eduardo (Brazil) — 3 October 2009 @ 10:11 pm

    • @Eduardo

      sorry, i dont have the c code at this moment :D .

      Comment by edipermadi — 5 October 2009 @ 10:41 am


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.