Algorithms

Vigenere Cipher

The Vigenère cipher is a method of encrypting text that uses a keyword to shift each letter of the message. Unlike simpler ciphers that use a fixed shift, Vigenère varies the shift based on the keyword, making it harder to crack. Here's how it works: You repeat the keyword to match the length of your message, then use each letter of the extended keyword to shift the corresponding letter in your message. For example, if your keyword is "KEY" and your message starts with "HELLO", you'd shift H by K (10 places), E by E (4 places), L by Y (24 places), L by K again, and O by E. This variable shifting makes patterns less obvious, as the same letter in your message can be encrypted differently each time it appears. To decrypt, you reverse the process, using the keyword to shift letters back to their original positions. While more secure than simple substitution ciphers, Vigenère can still be broken with advanced frequency analysis if the keyword length is discovered.

Time Complexity

Best CaseO(n)

Average CaseO(n)

Worst CaseO(n)

Implementation

Encoding

Encode your message using the Vigenere cipher