## 1. Binary code

binary code, digital system, ASCII code, encoding & decoding
## 2. Error detection/correction code

Errors in transmission and storage when using binary code.
Error detection with parity-check sums: adding an extra bit to keep an *even parity* (or *odd parity*).

How error-correcting code works: (1) divide bits in code into (overlapping) groups, (2) decide the parity of every group, (3) confirm parity during encoding and decoding.

Example: When the message is *a*_{1}a_{2}a_{3}a_{4}, the code word is *a*_{1}a_{2}a_{3}a_{4}c_{1}c_{2}c_{3}, where

*c*_{1} = a_{1}+a_{2}+a_{3}, c_{2} = a_{1}+a_{3}+a_{4}, c_{3} = a_{2}+a_{3}+a_{4}

1: message, 2: code word, 3: received code, 4: error correction

The *weight* of a binary code is the minimum number of 1's that occur among all nonzero code words of that code.

Assume the weight of a binary code is t. The code will detect (though not fix) t-1 errors. If t is odd, the code will correct (t-1)/2 errors, if t is even, the code will correct (t-2)/2 errors. For example, the weight of the above code (Table 17.1, page 534) is 3, so it can either detect 2 errors or correct 1 error.

The distance between two binary strings of equal length is the number of positions in which the two strings differ.

Nearest-Neighbor Decoding Method

Another distance-based explanation of error correcting code.

## 3. Compression coding

Data compression: lossless vs. lossy (example: ZIP vs. MP3)
Delta Encoding

Huffman Coding

## 4. Cryptography

Caesar cipher
Modular Arithmetic: *m* mod *n* is the remainder when *m* is divided by *n*.

Vigenere cipher

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

0 | 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 |

Credit card number, in binary code, can be encrypted and decrypted by adding the same binary key.

Public Key Encryption

Cryptogram

**Homework**: Chapter 17 Exercises No. 11, 21, 29, 32, 43