240280723022 AC&NS
Practical – 2
Objective: Creating the 16-round keys for the DES (Data
Encryption Standard) encryption algorithm
Steps to Generate the 16 Round Keys for DES:
1. Start with a 64-bit key:
The DES algorithm begins with a 64-bit key, but only 56 bits
are used (the remaining 8 bits are used for parity checking
and are ignored in key generation).
2. Apply the Permuted Choice 1 (PC-1):
From the 64-bit key, a permutation is applied using
the PC-1 table. This reduces the 64-bit key to a 56-bit
key.
3. Split into Left and Right halves:
Divide the 56-bit key into two halves: C (28 bits) and D
(28 bits).
4. Generate 16 subkeys:
For each of the 16 rounds:
1. Left circular shift (LSH): The left and right
halves are shifted by 1 or 2 positions depending on
the round.
2. Apply Permuted Choice 2 (PC-2): The shifted halves
are combined (56 bits) and permuted again using
the PC-2 table to generate a 48-bit subkey.
5. Print keys:
Each of the 16 keys is in 48-bit format and used in the
corresponding DES encryption/decryption round.
pg. 1
240280723022 AC&NS
Code : Github :)
pg. 2
240280723022 AC&NS
OUTPUT:
pg. 3