Variant Beaufort Cipher

Beaufort variant where plaintext subtracts the key (plain minus key)

Encrypts text with the variant Beaufort cipher, computing each letter as plaintext minus key modulo 26 — the inverse direction of standard Beaufort. Encryption and decryption use opposite operations. Runs in your browser. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

How does variant Beaufort differ from standard Beaufort?

Standard Beaufort computes ciphertext as key minus plaintext, modulo 26. The variant Beaufort reverses the operands and computes plaintext minus key, modulo 26. This makes the variant equivalent to a Vigenère decryption step, so encryption and decryption are not the same operation as they are in standard Beaufort.

The variant Beaufort cipher is a polyalphabetic substitution cipher closely related to both Beaufort and Vigenère. Where standard Beaufort enciphers a letter as key minus plaintext, the variant flips the subtraction to plaintext minus key, which is exactly the operation Vigenère uses when decrypting — making the two ciphers inverses of each other when using the same key.

How it works

Letters map to 0–25 (A=0, B=1 … Z=25). The keyword repeats over the message, advancing one step only when the next character is alphabetic:

P = plaintext letter index  (0..25)
K = key letter index        (0..25)

encrypt: C = (P - K + 26) mod 26
decrypt: P = (C + K) mod 26

The +26 before the modulo prevents negative values when P is smaller than K. Because encryption subtracts and decryption adds, the two operations are genuinely different — unlike standard Beaufort, where encryption and decryption use the same formula and the cipher is its own inverse.

Worked example step by step

Encrypt HELLO with the key KEY:

PositionPlaintextKey letterPKC = (P−K+26) mod 26Ciphertext
1HK710(7−10+26) mod 26 = 23X
2EE44(4−4+26) mod 26 = 0A
3LY1124(11−24+26) mod 26 = 13N
4LK1110(11−10+26) mod 26 = 1B
5OE144(14−4+26) mod 26 = 10K

HELLOXANBK with key KEY.

To decrypt XANBK with KEY, apply P = (C + K) mod 26 at each position: X=23+K=10 → 33 mod 26 = 7 = H, and so on — recovering HELLO.

Relationship to Vigenère and standard Beaufort

All three ciphers share the same tabula recta (the 26×26 alphabet-shift grid). The difference is which operands are subtracted:

CipherFormulaSelf-inverse?
VigenèreC = (P + K) mod 26No
Standard BeaufortC = (K − P) mod 26Yes
Variant BeaufortC = (P − K) mod 26No

Variant Beaufort encryption is exactly Vigenère decryption, and variant Beaufort decryption is exactly Vigenère encryption. This means if you encrypt a message with Vigenère and then decrypt the ciphertext with variant Beaufort using the same key, you get the original back — and vice versa.

Security considerations

Like all classical polyalphabetic ciphers, the variant Beaufort is vulnerable to cryptanalysis once the key period is determined:

  • Kasiski examination finds repeated ciphertext segments to estimate the key length.
  • Index of coincidence confirms the key length estimate.
  • Frequency analysis per position recovers each key letter from the letter frequencies within that column.

Short or dictionary-word keys are especially weak. Treat this cipher as a puzzle tool or educational demonstration, not a means of protecting real information. For genuine security, use modern authenticated encryption.