Cryptography Mini Project

DES Encryption,
Decryption & Key Schedule

A working interactive demonstration of the Data Encryption Standard: encrypt and decrypt data, inspect how a 64-bit DES key becomes sixteen 48-bit round keys, verify standard test vectors, and explore the effective 56-bit key space.

1โ€“2. DES Encryption & Decryption

The cryptographic operation uses the vendored CryptoJS DES reference implementation. HEX mode uses ECB + NoPadding for standard block test vectors; Text mode uses UTF-8 + PKCS#7 padding.

๐Ÿ”’ DES Encryption

The DES key is entered as exactly 16 hexadecimal characters = 64 bits including parity positions.

๐Ÿ”“ DES Decryption

Ciphertext must contain complete DES blocks: 16 hex characters per 64-bit block.

What happens inside DES?

A compact explanation for the classroom demo. DES processes 64-bit data blocks using a Feistel structure with 16 rounds.

1

64-bit data block

DES takes one 64-bit block at a time. The standard vector is exactly one block.

2

Initial permutation

The block is permuted and split into left and right 32-bit halves.

3

16 Feistel rounds

Each round combines one 48-bit round key with the round function and swaps halves.

4

Final permutation

After round 16, the halves are combined and the inverse permutation produces ciphertext.

3โ€“4. DES Key Schedule & Round-Key Order

Enter a 64-bit DES key and inspect the required path: 64-bit key โ†’ PC-1 โ†’ 56-bit key โ†’ C0/D0 โ†’ left shifts โ†’ C1โ€ฆC16 / D1โ€ฆD16 โ†’ PC-2 โ†’ K1โ€ฆK16.

5. DES Test Cases

The first case is the required standard DES vector from the assignment. The application also checks decryption and two additional known-answer vectors.

#TestAlgorithmInputYour OutputExpected OutputPASS / FAIL

Input Validation

The app rejects invalid or incomplete input with a useful message instead of crashing.

A

Empty input

Plaintext, ciphertext, and key fields are checked before DES runs.

B

Invalid DES key

The key must be exactly 16 hexadecimal characters (64 bits).

C

Invalid ciphertext

HEX ciphertext must contain complete 64-bit blocks.

D

Wrong text key

If decrypted bytes are not valid UTF-8, the app asks the user to check the key or use HEX output.

6. Security Feature โ€” DES Key Space

The assignment specifically asks to demonstrate DES key-space size instead of attempting a brute-force attack. A DES key is entered as 64 bits, but only 56 bits contribute to the effective key space.

๐Ÿ”‘ Why 56 effective bits?

Entered DES key64 bits
Parity positions8 bits
Effective DES key56 bits
Possible effective keys = 2โตโถ72,057,594,037,927,936
This is an educational demonstration. DES is obsolete for protecting real-world sensitive data; modern systems use stronger algorithms such as AES.

โฑ Interactive Key-Space Calculator

Assumed rateโ€”
Worst case: all 2โตโถ keysโ€”
Average case: half the key spaceโ€”

This calculator only demonstrates scale mathematically; it does not brute-force DES.

Classroom Demo Flow

A short sequence that covers every required feature without jumping around the page.

  1. Start with the required vector: load 0123456789ABCDEF and key 133457799BBCDFF1; show ciphertext 85E813540F0AB405.
  2. Decrypt it: use the same key and show that the original plaintext returns.
  3. Explain the key schedule: show PC-1, the 56-bit result, C0/D0, left shifts, and all K1โ€“K16.
  4. Show key order: encryption uses K1โ†’K16; decryption uses K16โ†’K1.
  5. Run test cases: demonstrate that the required vector and additional vectors all PASS.
  6. Trigger validation: remove a key character or enter non-HEX data to show a useful error.
  7. Finish with security: explain 64 input bits, 8 parity positions, 56 effective bits, and 2โตโถ possible keys.