Java tips, observations, bugs and problems from the world of Spring, Weblogic, Oracle, MySQL and many other technologies...

Tuesday, 23 August 2011

RC4 Encryption

Bazinga! I hope that everyone who read yesterday’s ROT13 blog spotted the Sheldon Cooper-esque 'clever prank' for the more secure double ROT13 aka ROT26 algorithm. Today’s blog takes encryption one step further and covers the hugely popular RC4 encryption algorithm developed by Ron Rivest, indeed the RC stands for Ron’s Code. Although now broken, the RC4 algorithm is still widely used in protocols such as SSL and WEP.

The RC4 cipher has two parts: firstly key set up and secondly, data encryption. The key setup is as follows: