Hello, Reader ^^! Back again with source code ^^! This time the source code is Vigenère Cipher for Alphabet only. The source code written in Java. Yup, it is translated from C++ into Java ^^. With this type of encryption, the plaintext is encrypted based on key which consists of a keyword. Each letter will be ciphered differently based on the sequence of its letter on plaintext and the key. Let's take an example.
Just say I have plaintext "Hello World!". I want to encrypt it using key "KEY". If encrypt it using Vigenère Cipher, here will be happens:
Plaintext | H | E | L | L | O | W | O | R | L | D | ! | |
Ciphertext | K | E | Y | K | E | Y | K | E | Y | K |
The key becomes "KEYKE YKEYK". Yup, it is repeated based on the length of the plaintext.
Using the Ci = (Pi + Ki ) mod 26 (C is Ciphertext, P is Plaintext, K is Key, i is Index), it will give result :
"RIJVS GSPVH!"
With that type of encryption, cracking the message using frequency analysis can be prevented.
Now, I also made another variant. It is Auto-Key. Using the example above, the key will be "KEYHE LLOWO", taking some part of the plaintext as key. The result will be "AIDSS HZFHR!". Okay, that's all I can say ^^. Thank you for reading ^^!
very cool
ReplyDeleteWilliam
@Will:
ReplyDeleteThanks ^^