As quoted on wikipedia, RC4 is a stream cipher designed by Professor Ronald Rivest from MIT. This block cipher employs simple bytewise permutation over 256 bytes state array. This characteristic makes RC4 easy to implement in programmable device such microcontroller.
AVR is a powerful microcontroller that cope all requirements needed for RC4 implementation, from indirect memory addressing for array operation, addition and so on. The lookup process of RC4 is depicted below.

The previous platform of RC4 implementation that I made was PIC18F4550, which gave good performance, but AVR is better. AVR has more specific single cycled instruction that made it faster and superior than PIC18F4550 on this case.
In order to validate cipher result, I tested my code to encrypt plain text “Plaintext” with cipherkey “Key” and it generated the same hex value which was “BBF316E8D940AF0AD3″. The test vector example was taken from RC4 page on wikipedia. Take a look those three pictures below.
Plain Text

Cipher Key

Cipher Text

RELATED STUFF
Download :
Source Code | v1.0
Reference:
RC4
Ronald Rivest




Damn man!! you’re such talented cryptography artist!!!!
Keep on Crazy dude!!!
-a guy who always support you-
Comment by Takhta Pandu Padmanegara — 14 January 2009 @ 7:57 pm
@padmanegara : thank you my bro
Comment by edipermadi — 15 January 2009 @ 9:26 am
i need guidance related to stream cipher specific in a5/1.
Comment by akalili — 17 July 2009 @ 3:55 pm
@Akalili.
Hi. the A5/1 implementation is basically emulates the A5/1 workingflow in register transfer level way. try to understand the A5/1 in TTL implementation, then you can easily move to Microcontroller implementation.
Comment by edipermadi — 18 August 2009 @ 1:01 pm
hi,
i need your help in software implementation of hash function and stream cipher cryptography.
Comment by siddharth kumar — 16 September 2009 @ 11:40 pm
@siddarth
what can i help?
Comment by edipermadi — 17 September 2009 @ 10:14 am
Good Article. Thanks you in advance
8bit MCU implemetation ?
But, Your source code link is broken. check it please.
Comment by hbkim — 30 November 2009 @ 1:10 pm
@hbkim:
Thank you for spotting the broken link
Comment by edipermadi — 1 December 2009 @ 9:45 am
Thank you for this excellent piece of work. I really like the idea of putting cryptographic primitives into hardware.
If you implemented RC4, what do you think about implementing also stronger RC4 incarnation, VMPC?
See pastebin.com/J62Z3iHB
Comment by IZCP — 22 July 2010 @ 10:59 pm
Thank you for visiting my blog and also thank you for your valuable suggestion. I’m starting to read the VMPC spec
Comment by edipermadi — 23 July 2010 @ 3:50 pm