Hubbry Logo
Trifid cipherTrifid cipherMain
Open search
Trifid cipher
Community hub
Trifid cipher
logo
7 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Trifid cipher
Trifid cipher
from Wikipedia

The trifid cipher is a classical cipher invented by Félix Delastelle and described in 1902.[1] Extending the principles of Delastelle's earlier bifid cipher, it combines the techniques of fractionation and transposition to achieve a certain amount of confusion and diffusion: each letter of the ciphertext depends on three letters of the plaintext and up to three letters of the key.

The trifid cipher uses a table to fractionate each plaintext letter into a trigram,[2] mixes the constituents of the trigrams, and then applies the table in reverse to turn these mixed trigrams into ciphertext letters. Delastelle notes that the most practical system uses three symbols for the trigrams:[3]

In order to split letters into three parts, it is necessary to represent them by a group of three signs or numbers. Knowing that n objects, combined in trigrams in all possible ways, give n × n × n = n3, we recognize that three is the only value for n; two would only give 23 = 8 trigrams, while four would give 43 = 64, but three give 33 = 27.

Description

[edit]

As discussed above, the cipher requires a 27-letter mixed alphabet: we follow Delastelle by using a plus sign as the 27th letter.[4] A traditional method for constructing a mixed alphabet from a key word or phrase is to write out the unique letters of the key in order, followed by the remaining letters of the alphabet in the usual order.[5] For example, the key FELIX MARIE DELASTELLE yields the mixed alphabet FELIXMARDSTBCGHJKNOPQUVWYZ+.

To each letter in the mixed alphabet we assign one of the 27 trigrams (111, 112, …, 333) by populating a 3 × 3 × 3 cube with the letters of the mixed alphabet, and using the Cartesian coordinates of each letter as the corresponding trigram.

Layer 1 Layer 2 Layer 3
1 2 3 1 2 3 1 2 3
1 F E L 1 S T B 1 O P Q
2 I X M 2 C G H 2 U V W
3 A R D 3 J K N 3 Y Z +

From this cube we build tables for enciphering letters as trigrams and deciphering trigrams as letters:

Enciphering alphabet Deciphering alphabet
A = 131 J = 231 S = 211 111 = F 211 = S 311 = O
B = 213 K = 232 T = 212 112 = E 212 = T 312 = P
C = 221 L = 113 U = 321 113 = L 213 = B 313 = Q
D = 133 M = 123 V = 322 121 = I 221 = C 321 = U
E = 112 N = 233 W = 323 122 = X 222 = G 322 = V
F = 111 O = 311 X = 122 123 = M 223 = H 323 = W
G = 222 P = 312 Y = 331 131 = A 231 = J 331 = Y
H = 223 Q = 313 Z = 332 132 = R 232 = K 332 = Z
I = 121 R = 132 + = 333 133 = D 233 = N 333 = +

The encryption protocol divides the plaintext into groups of fixed size (plus possibly one short group at the end): this confines encoding errors to the group in which they occur,[6] an important consideration for ciphers that must be implemented by hand. The group size should be coprime to 3 to get the maximum amount of diffusion within each group: Delastelle gives examples with groups of 5 and 7 letters. He describes the encryption step as follows:[7]

We start by writing vertically under each letter, the numerical trigram that corresponds to it in the enciphering alphabet: then proceeding horizontally as if the numbers were written on a single line, we take groups of three numbers, look them up in the deciphering alphabet, and write the result under each column.

For example, if the message is aide-toi, le ciel t'aidera, and the group size is 5, then encryption proceeds as follows:

a i d e-t   o i l e c   i e l t'a   i d e r a
1 1 1.1 2   3 1 1.1 2   1 1 1.2 1   1 1 1.1 1
3.2 3 1.1   1.2 1 1.2   2.1 1 1.3   2.3 1 3.3
1 1.3 2 2   1 1.3 2 1   1 2.3 2 1   1 3.2 2 1
F M J F V   O I S S U   F T F P U   F E Q Q C

In this table the periods delimit the trigrams as they are read horizontally in each group, thus in the first group we have 111 = F, 123 = M, 231 = J, and so on.

Notes

[edit]

References

[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
The Trifid cipher is a classical polygraphic invented by the French amateur cryptographer Félix Delastelle in , serving as an extension of his earlier by incorporating a three-dimensional structure for enhanced and of letter frequencies. It operates as a manual, pencil-and-paper technique that combines substitution, transposition, and to convert into , typically using a 3×3×3 grid accommodating 27 symbols (the 26 English letters plus a marker such as a period). Delastelle, who developed several innovative ciphers in the late 19th and early 20th centuries, described the Trifid in his work on cryptographic methods, aiming to create a system more resistant to than simpler substitution ciphers. The key consists of a mixed derived from a keyword, which populates the grid layers, along with a chosen period (often 20) that determines grouping sizes during processing. In , each letter is first mapped to a unique coordinate triplet (layer, row, column) within the grid; these coordinates are then written vertically in groups based on the period, transposed by reading horizontally, regrouped into new triplets, and converted back to letters, with each ciphertext symbol representing three letters to obscure statistical patterns. Decryption reverses this process by mapping ciphertext to coordinates and reconstructing the original sequence. While the Trifid cipher represented an advancement in manual cryptography—offering greater security against basic cryptanalytic attacks like single-letter frequency counts compared to monoalphabetic systems—it remains vulnerable to more sophisticated methods, such as known-plaintext or exhaustive key searches, rendering it unsuitable for modern sensitive communications. Its design influenced later fractionating ciphers, and it continues to be studied in educational contexts for illustrating principles of and in .

History and Background

Invention and Inventor

The Trifid was invented by Félix Delastelle, a French cryptographer and civil servant who served as a bonded warehouseman at the port of for much of his professional life. Born on January 2, 1840, in Saint-Malo, Delastelle pursued cryptography as an amateur passion alongside his administrative duties in the customs service, retiring in 1900 after over four decades of public employment. Delastelle described the Trifid cipher in his 1902 book Traité Élémentaire de Cryptographie, published by Gauthier-Villars in shortly before his death on April 2, 1902. This work represented the culmination of his cryptographic endeavors, compiling and expanding upon methods he had developed over the previous decade. Delastelle's motivation for inventing the Trifid cipher stemmed from his interest in creating intricate manual encryption systems that obscured letter frequencies, thereby enhancing resistance to emerging cryptanalytic techniques like prevalent in late 19th- and early 20th-century manual . As an extension of his earlier , the Trifid aimed to fractionate more thoroughly while remaining feasible for hand computation. In the historical context of pre-World War I , Delastelle's contributions emerged during an era dominated by manual polygraphic ciphers, codebooks, and simple transpositions, where mechanical devices were still rare and cryptographers sought to balance security with practicality for diplomatic and .

Relation to Earlier Ciphers

The Trifid cipher represents a direct extension of Félix Delastelle's earlier , introduced in 1895 and first presented in the French journal Revue du Génie civil under the name "cryptographie nouvelle," by expanding the two-dimensional process into a three-dimensional one to increase the complexity and of the . In the , letters are converted to row-column coordinates within a and then transposed in a single layer, whereas the Trifid employs three stacked layers of coordinates (row, column, and layer) for , effectively tripling the positional information per letter and enhancing the rearrangement during transposition. This development draws foundational influences from the ancient , devised by the Greek historian in the second century BCE, which maps letters to a grid of numerical coordinates as a primitive form of substitution. Additionally, the Trifid incorporates elements of columnar transposition ciphers, where is written into columns and read out in an altered order to obscure sequences, adapting this to a fractionated grid-based system for greater intermixing of symbols. By integrating substitution via the keyed cube, fractionation through multi-dimensional coordinates, and transposition across layers, the Trifid innovates on these precursors to create a hybrid manual that achieves higher diffusion than its two-dimensional counterpart. This marks a progression in design: from one-dimensional simple substitution ciphers, which replace letters individually without positional mixing, to the two-dimensional bifid for layered , and finally to the three-dimensional Trifid for volumetric complexity. Delastelle's broader contributions to classical , including several fractionating systems, underscore his role in advancing grid-based techniques during the late 19th and early 20th centuries.

Cipher Mechanics

Alphabet and Key Preparation

The Trifid cipher employs a 27-character alphabet consisting of the 26 letters of the English alphabet (A–Z) and an additional symbol, typically a period (.) used as a filler or word separator. This expanded set accommodates the cipher's fractionation mechanism while handling the standard Latin alphabet. To prepare the key, a keyword or key phrase is selected, from which duplicate letters are removed to create a deranged sequence, followed by the remaining unused characters from the 27-character alphabet in standard order. For instance, using the keyword "FELIX MARIE DELASTELLE" yields the sequence FELIXMARDSTBCGHJKNOPQUVWYZ. after eliminating repeats and appending the period. This mixed alphabet of 27 unique symbols forms the basis for the cipher's lookup structure. The prepared is then arranged sequentially into a 3×3×3 cube, typically in row-major order: filling layer 1 (rows 1–3, columns 1–3), then layer 2, and finally layer 3. This structure provides unique positions for all 27 symbols across the three distinct layers, enabling the coordinate-based . Variations may use different filling orders if specified, but the standard implementation distributes symbols uniquely throughout the cube. Non-alphabetic characters in the plaintext are typically ignored during processing or substituted with the period (.) to fit the alphabet. This preparation step, rooted in adaptations of Polybius square principles, ensures a consistent mapping for subsequent cipher operations.

Coordinate System and Fractionation

The Trifid cipher employs a three-dimensional coordinate system to map the 27 characters of its alphabet (the 26 English letters A–Z plus a period symbol) into a 3×3×3 cube for fractionation. This structure consists of three layers, each a 3×3 grid, together containing the full set of 27 unique characters arranged according to the cipher's key. Each character is thus assigned a unique triplet of coordinates: the layer number (1 to 3), the row number (1 to 3), and the column number (1 to 3). This assignment allows a single letter to be decomposed into three independent numerical components (each 1–3), facilitating the cipher's core mechanism of breaking down the plaintext into smaller, interspersed parts. Fractionation in the Trifid cipher transforms the into a continuous stream of these coordinates. For a of n, the process generates 3n individual numbers: a sequence of n layer coordinates, n row coordinates, and n column coordinates, extracted from each letter's triplet. These three separate streams (layers, rows, and columns) are then arranged into a transposition matrix for mixing, with the of each row determined by the chosen period, denoted as p (defaulting to 20 in the original , though smaller values like 5 are often used in illustrative contexts for manageability). Specifically, for each block of p letters, the layer stream is written into the first row of p, the row stream into the second row, and the column stream into the third row; if the is not a multiple of p, the final incomplete block is padded or handled separately. This step disperses the coordinate components across the matrix, preparing them for rearrangement without altering the overall count of elements. The mixing phase completes the fractionation by transposing the matrix: it is read column-wise, where each column provides a new triplet (layer from first row, row from second, column from third of that column position), producing p new triplets per block. These new triplets are then mapped back to characters using the cube. This transposition of the combined streams ensures that the original positional relationships are thoroughly scrambled, contributing to the cipher's resistance against simple frequency analysis while maintaining reversibility for decryption. The process repeats for each block of p letters until the entire message is processed.

Encryption and Decryption

Step-by-Step Encryption

The Trifid cipher encryption process begins with the preparation of a key grid, consisting of a 3×3×3 cube filled with the 26 letters of the plus a null symbol (such as a period or 'X'), arranged according to a keyword that eliminates duplicates and fills the remainder in standard order. Each position in the cube is defined by a triplet of coordinates: layer (1-3), row (1-3), and column (1-3), where layers represent the depth dimension. To encrypt a , first convert each letter to its corresponding coordinate triplet, resulting in a sequence of 3n numbers for a message of n. Select a period k (typically between 5 and 20, often 20 for ), and for each block of k letters (or fewer for the last block), write the 3k coordinates into a 3 × k block (or 3 × m for m < k in the final block), separating them into three parallel rows: the top row for the k layer coordinates, the middle row for the k row coordinates, and the bottom row for the k column coordinates. This step mixes the positional information across the three dimensions. Next, read the block row by row from left to right, starting with the top row, then the middle row, then the bottom row, producing a mixed stream of 3k numbers consisting of all layer coordinates followed by all row coordinates followed by all column coordinates. Divide this stream into groups of three consecutive numbers, interpreting each group as a new layer-row-column triplet. Finally, convert each triplet back to the corresponding letter or symbol in the key grid, concatenating them to form the block of , which is typically written without spaces or punctuation from the original . The period k determines the block and influences the of the transposition, with longer periods generally enhancing security by increasing the mixing depth.

Step-by-Step Decryption

The decryption of a Trifid reverses the fractionation and mixing processes applied during , requiring knowledge of the same 3×3×3 key grid and period length used for enciphering the message. Without the period length, decryption is infeasible without , as it determines the matrix dimensions for unmixing the coordinate streams. The process begins by converting each ciphertext letter to its corresponding triplet of coordinates (layer, row, column, each ranging from 1 to 3) using the key grid; for a block of k letters, this yields 3k digits. Concatenate these digits into a single sequence and arrange them row-wise into a 3 × k matrix (or 3 × m for m < k in the final block). The matrix is then read column-wise, taking the three digits from top to bottom in each column from left to right; each such triplet corresponds to the coordinates of one letter. Map each triplet back to its letter using the key grid. The process is applied separately to each block. Misalignment in period length or key grid application results in garbled output, as the coordinates fail to reconstruct correctly, emphasizing the cipher's reliance on precise parameter matching.

Examples and Applications

Illustrative Encryption Example

To illustrate the process of the Trifid , consider a sample key "KEYWORD" used to construct the mixed alphabet of 27 symbols (A–Z and a period "." to represent spaces or ). The unique letters from the key are K, E, Y, W, O, R, D, followed by the remaining letters A, B, C, F, G, H, I, J, L, M, N, P, Q, S, T, U, V, X, Z, and the period ".". This mixed alphabet is filled sequentially into a 3×3×3 , with layers representing the first coordinate (z = 1 to 3), rows the second (y = 1 to 3), and columns the third (x = 1 to 3). The resulting cube is as follows:
Layer (z)Row (y=1)Row (y=2)Row (y=3)
1K E YW O RD A B
2C F GH I JL M N
3P Q ST U VX Z .
For this example, use a period of 9 for clarity in demonstrating the grouping and mixing steps, and encrypt the "HELLO WORLD" by replacing the space with "." to yield "HELLO.WORLD." (11 characters total). First, convert each plaintext letter to its coordinates (z y x) using the cube:
  • H: (2 2 1)
  • E: (1 1 2)
  • L: (2 3 1)
  • L: (2 3 1)
  • O: (1 2 2)
  • .: (3 3 3)
  • W: (1 2 1)
  • O: (1 2 2)
  • R: (1 2 3)
  • L: (2 3 1)
  • D: (1 3 1)
Since the period is 9, process the first 9 letters ("HELLO.WOR") as one group and the remaining 2 ("LD") as another. For the first group, extract the coordinate streams:
  • z stream: 2 1 2 2 1 3 1 1 1
  • y stream: 2 1 3 3 2 3 2 2 2
  • x stream: 1 2 1 1 2 3 1 2 3
Concatenate these streams in order (z then y then x) to form the mixed sequence: 2 1 2 2 1 3 1 1 1 2 1 3 3 2 3 2 2 2 1 2 1 1 2 3 1 2 3. Divide this 27-number sequence into 9 trigrams of 3 numbers each (z y x for each letter), and map back to letters using the cube:
  • 2 1 2 → F
  • 2 1 3 → G
  • 1 1 1 → K
  • 2 1 3 → G
  • 3 2 3 → V
  • 2 2 2 → I
  • 1 2 1 → W
  • 1 2 3 → R
  • 1 2 3 → R
For the second group ("LD"):
  • z stream: 2 1
  • y stream: 3 3
  • x stream: 1 1
Concatenate: 2 1 3 3 1 1. Divide into 2 trigrams:
  • 2 1 3 → G
  • 3 1 1 → P
The resulting is "FGKGVIWRRGP" (spaces added here for readability corresponding to the original groups; in practice, it is written continuously as FGKGVIWRRGP).

Illustrative Decryption Example

To illustrate the decryption process, consider the ciphertext "SJLKZT" generated from the "SECRET" using the standard Trifid key with a 27-character (A-Z plus a null symbol for the 27th position) and a period of 5. The decryption begins by converting each ciphertext letter to its corresponding coordinates in the key cube, which consists of three 3x3 layers:
  • Layer 1: A B C / D E F / G H I
  • Layer 2: J K L / M N O / P Q R
  • Layer 3: S T U / V W X / Y Z _
The coordinates (layer, row, column) are:
  • S: 3,1,1
  • J: 2,1,1
  • L: 2,1,3
  • K: 2,1,2
  • Z: 3,3,2
  • T: 3,1,2
This yields the concatenated digit stream: 3 1 1 2 1 1 2 1 3 2 1 2 3 3 2 3 1 2 (18 digits total). Since the period is 5 and the first five letters produce 15 digits (a complete 3x5 grid), process them first by writing the digits row-wise into a 3-row by 5-column grid:
Row/LayerCol 1Col 2Col 3Col 4Col 5
1 (mixed layers/rows/cols start)31121
212132
312332
Read the grid column-wise to recover the triples (one per column): 3-1-1, 1-2-2, 1-1-3, 2-3-3, 1-2-2. These map back to letters S, E, C, R, E. The remaining three digits from the sixth letter (3 1 2) form an untransposed triple since the group is incomplete, mapping to T. The recovered is thus "SECRET". This demonstrates the key alignment of the three coordinate streams to reverse the fractionation without shifts, assuming the period is known; if unknown, trial values coprime to 3 (e.g., 5 or 7) are tested for coherent output.

Security and Cryptanalysis

Strengths and Weaknesses

The Trifid cipher exhibits high through its three-dimensional process, which converts each letter into a of coordinates and mixes them across layers, effectively disrupting unigram and frequencies to resist simple . This polygraphic structure combines substitution, , and transposition, providing stronger than many contemporary manual ciphers by flattening the statistical profile of the . Additionally, its allows for straightforward manual implementation using pencil and paper, making it one of the first practical trigraphic ciphers suitable for hand execution without mechanical aids. Despite these advantages, the cipher's security is limited by a relatively constrained key space, as the 3x3x3 relies on a of approximately 27 characters (merging I and J or using 27 distinct symbols), although the arrangement is based on a keyword-derived of 27 symbols, yielding a large key space of 27! possibilities, plus the choice of period. The repetition inherent in the grid structure across dimensions further reduces the overall key diversity compared to more varied systems. It is also vulnerable to known-plaintext attacks if the transposition period can be guessed, as statistical tests like chi-square can identify the period from ciphertext patterns. While offering greater complexity and security than the related through its additional layer, the Trifid's intricate manual steps make it prone to errors in practice, contributing to its infrequent historical adoption. In its historical context around 1902, the Trifid was regarded as robust against casual due to its innovative , providing a significant advance over simpler substitution or transposition methods of the era. However, modern cryptanalytic techniques render it insecure for any sensitive applications today.

Known Attacks and Breaking Methods

The Trifid cipher, despite its fractionation into , retains detectable higher-order frequency patterns in the , allowing cryptanalysts to perform on reconstructed triplets after period identification. These patterns arise because the mixing of trigram components does not fully randomize the distribution, enabling the recovery of likely coordinate assignments through comparison with expected English frequencies. Period detection is a foundational step in breaking the Trifid cipher, as its columnar transposition relies on a fixed period (commonly 9 or 20, though variable). Analysts use the (IoC) or to identify the period by measuring repetitions or similarity in divided streams; for instance, an IoC value approaching 0.066–0.067 for English suggests a matching period when applied to potential divisions. Repeat patterns across aligned groups further confirm the period, such as 6- or 7-letter repeats spanning division lines. Known-plaintext attacks exploit partial knowledge, such as common words like "the" or "assume," to align streams and derive coordinates. By fractionating the known into layers (e.g., T=111, H=212 for "the") and matching against equivalents, analysts tabulate consistent sets (e.g., Set A=1, Set B=2) to reconstruct the key cube without full exhaustive search. This method succeeds on messages longer than 100 letters, recovering multiple values iteratively. Modern computational breaks employ hill-climbing algorithms to optimize key cube permutations and period guesses by maximizing n-gram fitness scores against the , often succeeding on messages of moderate length (200–500 characters). Genetic algorithms can similarly evolve candidate keys, though hill-climbing is more commonly implemented in solvers due to its efficiency on the 27! possible cube arrangements reduced by constraints. Historical manual breaks, such as those documented in the early , relied on exhaustive testing of short periods and probable words. It was allegedly used by Italians in , indicating potential vulnerability to such pattern-based recovery on operational traffic. Software tools facilitate automated breaking, including CryptoCrack's hill-climbing and dictionary-assisted solvers for period and keyword recovery, as well as online decoders like dCode.fr that implement brute-force enumeration for small periods. These tools typically require user input on suspected periods but output probable plaintexts with success rates exceeding 90% on text.
Add your contribution
Related Hubs
User Avatar
No comments yet.