Vigenère and Beaufort Ciphers are polyalphabetic substitution ciphers that use a keyword to encrypt and decrypt messages.
Variables:
L - The length of the available alphabet. For the English alphabet (a-z), L = 26.
m ∈ M - Your selected plaintext is a message (m) which is an element of the entire message space (M).
k ∈ K - Your selected keyword is a key (k) which is an element of the entire key space (K).
c ∈ C - The resulting ciphertext (c) which is an element of the entire ciphertext space.
Indices:
mn - The n-th letter of the current plaintext message. The current plaintext letter being processed.
kn - The n-th letter of the current keyword, using modulo operation relative to the keyword length.
cn - The n-th letter of the current ciphertext. The letter of the ciphertext that is being generated.
How it works:
Encryption (Vigenère): cn = (mn + kn) % L
Decryption (Vigenère): mn = (cn - kn + L) % L
Encryption (Beaufort): cn = (kn - mn + L) % L
Decryption (Beaufort): mn = (kn - cn + L) % L