Recent from talks
Nothing was collected or created yet.
Trifid cipher
View on WikipediaThe 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]- ^ Delastelle, pp. 101–3.
- ^ Hence the name trifid, which means "divided into three parts" (Oxford English Dictionary).
- ^ Delastelle, p. 101: "Afin de pouvoir fragmenter les lettres en trois parties…"
- ^ Delastelle, p. 102: "Mais l'alphabet français ne contenant que vingt-six lettres…"
- ^ See substitution cipher.
- ^ Gaines, p. 210.
- ^ Delastelle, p. 102: "Nous commençons par inscrire verticalement sous chaque lettre…"
References
[edit]- Delastelle, Félix (1902). Traité Élémentaire de Cryptographie. Paris: Gauthier-Villars.
- Gaines, Helen (1939). Cryptanalysis: A Study of Ciphers and Their Solution. New York: Dover.
Trifid cipher
View on GrokipediaHistory and Background
Invention and Inventor
The Trifid cipher was invented by Félix Delastelle, a French cryptographer and civil servant who served as a bonded warehouseman at the port of Saint-Malo 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 Paris shortly before his death on April 2, 1902.[4] 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 frequency analysis prevalent in late 19th- and early 20th-century manual cryptography. As an extension of his earlier bifid cipher, the Trifid aimed to fractionate plaintext more thoroughly while remaining feasible for hand computation.[5] In the historical context of pre-World War I cryptography, 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 military communications.[6]Relation to Earlier Ciphers
The Trifid cipher represents a direct extension of Félix Delastelle's earlier bifid cipher, 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 fractionation process into a three-dimensional one to increase the complexity and diffusion of the encryption.[7][8] In the bifid cipher, letters are converted to row-column coordinates within a Polybius square and then transposed in a single layer, whereas the Trifid employs three stacked layers of coordinates (row, column, and layer) for fractionation, effectively tripling the positional information per letter and enhancing the rearrangement during transposition.[7][8] This development draws foundational influences from the ancient Polybius square, devised by the Greek historian Polybius in the second century BCE, which maps letters to a grid of numerical coordinates as a primitive form of substitution.[9] Additionally, the Trifid incorporates elements of columnar transposition ciphers, where plaintext 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.[8] By integrating substitution via the keyed Polybius cube, fractionation through multi-dimensional coordinates, and transposition across layers, the Trifid innovates on these precursors to create a hybrid manual cipher that achieves higher diffusion than its two-dimensional counterpart.[8] This marks a progression in cipher design: from one-dimensional simple substitution ciphers, which replace letters individually without positional mixing, to the two-dimensional bifid for layered fractionation, and finally to the three-dimensional Trifid for volumetric complexity.[7][8] Delastelle's broader contributions to classical cryptography, including several fractionating systems, underscore his role in advancing grid-based techniques during the late 19th and early 20th centuries.[8]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.[3][10] 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.[11] For instance, using the keyword "FELIX MARIE DELASTELLE" yields the sequence FELIXMARDSTBCGHJKNOPQUVWYZ. after eliminating repeats and appending the period.[12] This mixed alphabet of 27 unique symbols forms the basis for the cipher's lookup structure. The prepared alphabet 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.[12][10] This structure provides unique positions for all 27 symbols across the three distinct layers, enabling the coordinate-based fractionation. 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.[10] This preparation step, rooted in adaptations of Polybius square principles, ensures a consistent mapping for subsequent cipher operations.[11]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.[3][10] 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 plaintext message into a continuous stream of these coordinates. For a message of length n, the process generates 3n individual numbers: a sequence of n layer coordinates, n row coordinates, and n column coordinates, extracted from each plaintext letter's triplet. These three separate streams (layers, rows, and columns) are then arranged into a transposition matrix for mixing, with the length of each row determined by the chosen period, denoted as p (defaulting to 20 in the original design, though smaller values like 5 are often used in illustrative contexts for manageability).[12] Specifically, for each block of p letters, the layer stream is written into the first row of length p, the row stream into the second row, and the column stream into the third row; if the message length 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.[3] 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.[3][10]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 alphabet 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.[3] 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.[13] To encrypt a plaintext message, first convert each letter to its corresponding coordinate triplet, resulting in a sequence of 3n numbers for a message of length n.[3] Select a period length k (typically between 5 and 20, often 20 for security), 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.[13] This fractionation step mixes the positional information across the three dimensions.[3] 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.[12] Divide this stream into groups of three consecutive numbers, interpreting each group as a new layer-row-column triplet.[3] Finally, convert each triplet back to the corresponding letter or symbol in the key grid, concatenating them to form the block of ciphertext, which is typically written without spaces or punctuation from the original message. The period k determines the block size and influences the diffusion of the transposition, with longer periods generally enhancing security by increasing the mixing depth.[13][3]Step-by-Step Decryption
The decryption of a Trifid cipher reverses the fractionation and mixing processes applied during encryption, requiring knowledge of the same 3×3×3 key grid and period length used for enciphering the message.[3][14] Without the period length, decryption is infeasible without trial and error, as it determines the matrix dimensions for unmixing the coordinate streams.[3] 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.[3][14] 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).[12] 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 plaintext letter.[3][14] Map each triplet back to its plaintext letter using the key grid.[3][14] 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.[3]Examples and Applications
Illustrative Encryption Example
To illustrate the encryption process of the Trifid cipher, consider a sample key "KEYWORD" used to construct the mixed alphabet of 27 symbols (A–Z and a period "." to represent spaces or punctuation). 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 cube, 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) |
|---|---|---|---|
| 1 | K E Y | W O R | D A B |
| 2 | C F G | H I J | L M N |
| 3 | P Q S | T U V | X Z . |
- 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)
- 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
- 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
- z stream: 2 1
- y stream: 3 3
- x stream: 1 1
- 2 1 3 → G
- 3 1 1 → P
Illustrative Decryption Example
To illustrate the decryption process, consider the ciphertext "SJLKZT" generated from the plaintext "SECRET" using the standard Trifid key with a 27-character alphabet (A-Z plus a null symbol for the 27th position) and a period of 5.[12] 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 _
- S: 3,1,1
- J: 2,1,1
- L: 2,1,3
- K: 2,1,2
- Z: 3,3,2
- T: 3,1,2
| Row/Layer | Col 1 | Col 2 | Col 3 | Col 4 | Col 5 |
|---|---|---|---|---|---|
| 1 (mixed layers/rows/cols start) | 3 | 1 | 1 | 2 | 1 |
| 2 | 1 | 2 | 1 | 3 | 2 |
| 3 | 1 | 2 | 3 | 3 | 2 |
