Saturday, December 18, 2010

PHP: Vigenere Cipher

I needed to use Vigenere Cipher to encrypt my data for my server-side applications. After a quick research,  I got a code from a forum and made some modifications to them. Now, the default code is also able to encrypt more than just 26 alphabets. An EnsureKeyValid function is added to ensure that only valid indexes are used.

You can download the Vigenere Cipher Class here and the class tester here.
Alternatively, you can go to my personal website to download them.

The output of my tester is:
attackatdawn = lxFopveFrnHr = attackatdawn

'lxFopveFrnHr' is the encrypted form of 'attackatdawn'

Here are some snapshots:





















To test the class:















Output:

No comments:

Post a Comment