S-DES Book Chapter
PDF 4. Book chapter 3.1, pages 50-56: S-DES structure, key generation, encryption detail, analysis and the relationship to DES.
1. Simplified DES (S-DES) Key Generation Solved Example in Cryptograhy by Vidya Mahesh HuddarMahesh Huddar · S-DES key generation: P10, shifts, P8, K1 and K2, 6 min
S - DES Decryption || Simplified data encryption standard(S-DES) || Explanation with exampleLectures by Shreedarshan K · S-DES decryption with an example (K2 first, then K1), 14 min
Simplified DES Example (CSS322, Lecture 5, 2013)Steven Gordon · long lecture: a complete S-DES example, 44 minChapter overviewSearch on YouTube
Purpose of S-DESSearch on YouTube
This page follows the book section 3.1 on Simplified DES (S-DES). The book puts S-DES before full DES. A study of S-DES makes DES easier to understand.
- S-DES is an educational algorithm. It is not a secure algorithm.
- It has similar properties and structure to DES, but much smaller parameters.
- Professor Edward Schaefer of Santa Clara University developed it ([SCHA96]).
- The book tells you to work through an example by hand while you read.
- A footnote says that you can skip S-DES on a first reading. If the details of DES confuse you, come back to S-DES.
Inputs and outputsSearch on YouTube
The S-DES encryption algorithm takes an 8-bit block of plaintext (example: ) and a 10-bit key. It produces an 8-bit block of ciphertext.
The decryption algorithm takes the 8-bit block of ciphertext and the same 10-bit key. It produces the original 8-bit block of plaintext.
Five functionsSearch on YouTube
The encryption algorithm has five functions:
- An initial permutation (IP).
- A complex function . It does permutation and substitution, and it uses a key input.
- A simple permutation function SW. It switches the two halves of the data.
- The function again, with the other subkey.
- A permutation function that is the inverse of IP ().
The book repeats a lesson from chapter 2. Multiple stages of permutation and substitution give a more complex algorithm. This makes cryptanalysis more difficult.
Composition formSearch on YouTube
The book writes encryption as a composition of functions (Figure 3.1):
The two subkeys are:
Decryption formSearch on YouTube
Decryption is essentially the reverse of encryption. The subkey order changes:
| Step | Encryption | Decryption |
|---|---|---|
| 1 | IP | IP |
| 2 | with | with |
| 3 | SW | SW |
| 4 | with | with |
| 5 |
XORs into the left half. The right half does not change. Thus the same with the same subkey removes the XOR again. Decryption needs no inverse of or of the S-boxes. Only the subkey order changes.
Key generationSearch on YouTube
Why a 10-bit keySearch on YouTube
The function takes the data and an 8-bit key. The book gives three possible designs:
| Option | Book comment |
|---|---|
| A 16-bit key, split into two 8-bit subkeys | Possible design: one subkey for each |
| One 8-bit key, used twice | Possible design: the same key in both stages |
| A 10-bit key, with two 8-bit subkeys made from it | The compromise that S-DES uses |
The key first goes through the permutation P10. Then a shift operation occurs. The shift output goes through P8 and gives subkey . The shift output also goes into a second shift and a second P8. This gives subkey (Figure 3.2).
P10 and P8Search on YouTube
S-DES uses a 10-bit key shared between sender and receiver. The key schedule makes two 8-bit subkeys for particular stages of encryption and decryption.
Call the 10-bit key . The book defines P10 as:
| P10 | 3 | 5 | 2 | 7 | 4 | 10 | 1 | 9 | 8 | 6 |
|---|
| P8 | 6 | 3 | 7 | 4 | 8 | 5 | 10 | 9 |
|---|
Read each table from left to right. Each position gives the input bit for that output position. Thus the first output bit is input bit 3. The second output bit is input bit 5. P8 selects and permutes 8 of the 10 bits.
Worked key scheduleSearch on YouTube
The book uses the key :
| Step | First 5 bits | Second 5 bits |
|---|---|---|
| Key | ||
| After P10 | ||
| After LS-1 (circular left shift by 1) | ||
| After LS-2 (2 more positions) |
- Apply P8 to the LS-1 output . The result is .
- Go back to the two 5-bit strings from LS-1.
- Do a circular left shift of 2 positions on each string.
- Apply P8 to . The result is .
P10 = 3 5 2 7 4 | 10 1 9 8 6. P8 = 6 3 7 4 | 8 5 10 9. Shifts: 1, then 2 more. P8 runs after each shift step.
Encryption detailSearch on YouTube
Initial and final permutationsSearch on YouTube
The input is an 8-bit block of plaintext. IP permutes it first:
| IP | 2 | 6 | 3 | 1 | 4 | 8 | 5 | 7 |
|---|
IP keeps all 8 bits of the plaintext, but it mixes them. At the end of the algorithm, the inverse permutation occurs:
| 4 | 1 | 3 | 5 | 7 | 2 | 8 | 6 |
|---|
An example shows that the second permutation is the reverse of the first: .
The function f_KSearch on YouTube
is the most complex part of S-DES. It combines permutation and substitution functions. Let L be the leftmost 4 bits and R the rightmost 4 bits of the 8-bit input. Let F be a mapping from 4-bit strings to 4-bit strings. F is not necessarily one-to-one.
SK is a subkey. is the bit-by-bit exclusive-OR.
Book example: the IP output is . Assume for some key SK. Then , so:
Expansion and permutationSearch on YouTube
The mapping takes a 4-bit number . The first operation is an expansion/permutation:
| E/P | 4 | 1 | 2 | 3 | 2 | 3 | 4 | 1 |
|---|
The book shows the 8 output bits in two rows:
| Row | Bits |
|---|---|
| Top row (to S0) | |
| Bottom row (to S1) |
XOR with the subkeySearch on YouTube
XOR the 8-bit subkey into these bits:
Rename the 8 bits:
| col 0 | col 1 | col 2 | col 3 | |
|---|---|---|---|---|
| Row 0 | ||||
| Row 1 |
The first 4 bits (row 0) go into S-box S0. S0 gives a 2-bit output. The other 4 bits (row 1) go into S1. S1 gives another 2-bit output.
The S-boxesSearch on YouTube
The entries are 2-bit values, shown in decimal:
| 0 | 1 | 2 | 3 | |
|---|---|---|---|---|
| 0 | 1 | 0 | 3 | 2 |
| 1 | 3 | 2 | 1 | 0 |
| 2 | 0 | 2 | 1 | 3 |
| 3 | 3 | 1 | 3 | 2 |
| 0 | 1 | 2 | 3 | |
|---|---|---|---|---|
| 0 | 0 | 1 | 2 | 3 |
| 1 | 2 | 0 | 1 | 3 |
| 2 | 3 | 0 | 1 | 0 |
| 3 | 2 | 1 | 0 | 3 |
To use an S-box:
- Use the first and fourth input bits as a 2-bit row number.
- Use the second and third input bits as a 2-bit column number.
- Write the entry at that row and column in base 2. This is the 2-bit output.
Book example: and . Read row 0, column 2 of S0. The entry is 3, or in binary. and select a row and column of S1 in the same way.
P4 permutationSearch on YouTube
The 4 bits from S0 and S1 go through one more permutation:
| P4 | 2 | 4 | 3 | 1 |
|---|
The output of P4 is the output of the function .
The switch functionSearch on YouTube
changes only the leftmost 4 bits of its input. The switch function SW interchanges the left 4 bits and the right 4 bits. Thus the second operates on a different 4 bits.
| Instance of | Bits that go into F | Key |
|---|---|---|
| First | Right 4 bits of the IP output | |
| Second | Right 4 bits after SW (the old left half) |
In the second instance, the E/P, S0, S1 and P4 functions do not change. Only the key input changes to .
Analysis of S-DESSearch on YouTube
Brute-force attackSearch on YouTube
A brute-force attack on S-DES is certainly feasible. A 10-bit key gives only possible keys. The attacker tries each key on the ciphertext. Then the attacker checks if the result is reasonable plaintext.
Known-plaintext equationsSearch on YouTube
The book considers a known-plaintext attack:
- The attacker knows one plaintext and its ciphertext .
- The key is unknown.
Each is a polynomial function of the and bits. Thus the algorithm becomes 8 nonlinear equations in 10 unknowns. There are a number of possible solutions. The attacker can calculate and analyze each solution.
Source of nonlinearitySearch on YouTube
- All the permutations and additions are linear maps.
- The S-boxes give the nonlinearity.
Rename the S0 input . Rename the S1 input . Let the 4-bit output be . These equations define S0:
All additions are modulo 2. Similar equations define S1. The algorithm alternates linear maps and these nonlinear maps. This gives complex polynomial expressions for the ciphertext bits. Thus cryptanalysis is difficult.
Scale of the problemSearch on YouTube
| Quantity | Value |
|---|---|
| Unknowns (key bits) | 10 |
| Equations (ciphertext bits) | 8 |
| Possible terms in one binary polynomial of 10 unknowns | |
| Average expected terms in each equation |
The book says that a reader can try to find these equations with a symbolic processor. Either the reader or the software stops before much progress occurs.
Exam figures: brute force needs at most trials. A known-plaintext attack gives 8 nonlinear equations in 10 unknowns.
Relationship to DESSearch on YouTube
DES compositionSearch on YouTube
DES operates on 64-bit blocks of input. The book writes the DES encryption scheme as:
DES uses a 56-bit key. The key schedule calculates sixteen 48-bit subkeys. It starts with an initial permutation of 56 bits. A sequence of shifts and permutations of 48 bits follows.
Scaled-up partsSearch on YouTube
| Item | S-DES | DES |
|---|---|---|
| Input block | 8 bits | 64 bits |
| Key | 10 bits | 56 bits |
| Subkeys | Two 8-bit subkeys | Sixteen 48-bit subkeys |
| input | 4 bits | 32 bits |
| Expansion output | 8 bits in 2 rows | 48 bits in 8 rows |
| Subkey XOR | 8-bit subkey | 48-bit subkey |
| S-boxes | 2 boxes, 4 rows × 4 columns | 8 boxes, 4 rows × 16 columns |
| S-box row | First and fourth bits | First and last bits of the row |
| S-box column | Middle 2 bits | Middle 4 bits |
The book draws the DES expansion as a matrix of 8 rows. Each row has 6 bits:
n32 | n1 n2 n3 n4 | n5
n4 | n5 n6 n7 n8 | n9
. | . | .
n28 | n29 n30 n31 n32 | n1XOR this matrix with a 48-bit subkey. Each of the 8 rows then goes into one S-box.
For "explain S-DES", write the five functions, the key schedule and the steps. For "S-DES versus DES", use the table above.
Quick self-testSearch on YouTube
What sizes does S-DES use, and why does the key have 10 bits?
The plaintext block is 8 bits. The key is 10 bits. The ciphertext block is 8 bits. The two stages each need an 8-bit subkey. A 16-bit key or one 8-bit key used twice were possible. The 10-bit key is the compromise: P10, shifts and P8 make both subkeys.
Who developed S-DES and what is its purpose?
Professor Edward Schaefer of Santa Clara University. It is an educational algorithm, not a secure one. It has a structure like DES with much smaller parameters. A study of S-DES helps you understand DES.
Compute K1 and K2 for the key 1010000010.
P10 gives . LS-1 gives . P8 gives . LS-2 gives . P8 gives .
Write the decryption composition.
. The functions are the same as in encryption. is used first and second.
Define f_K with the book example.
. The IP output is and . Then , so .
Give the S-box lookup rule with the book example.
The first and fourth bits give the row. The second and third bits give the column. The entry in base 2 is the output. Row 0, column 2 of S0 is 3, so the output is .
Why is SW necessary?
changes only the leftmost 4 bits. SW interchanges the halves. Thus the second operates on different bits. It uses the same E/P, S0, S1 and P4, with key .
What does the analysis say about breaking S-DES?
Brute force needs only trials. A known-plaintext attack gives 8 nonlinear equations in 10 unknowns. Permutations and additions are linear. Only the S-boxes are nonlinear. Each equation has about terms on average.
State the relationship between S-DES and DES.
DES has 64-bit blocks and a 56-bit key, with sixteen 48-bit subkeys. acts on 32 bits, and the expansion gives 48 bits. DES has 8 S-boxes with 4 rows and 16 columns. The outer bits select the row and the middle 4 bits select the column.
- S-DES (Schaefer) is an educational cipher: 8-bit block, 10-bit key, five functions, two 8-bit subkeys.
- Encryption: . Decryption uses first, then .
- Key schedule: P10, LS-1, P8 gives . LS-2 and P8 give . Key gives and .
- . is E/P, XOR with the subkey, S0 and S1, then P4.
- Brute force needs trials. Cryptanalysis gives 8 nonlinear equations in 10 unknowns. Only the S-boxes are nonlinear.
- DES scales every part: 64-bit block, 56-bit key, sixteen 48-bit subkeys, 32-bit input, 8 S-boxes of 4 × 16.