# Notes16

```Number Theory
d|a
a = kd for k  
(This means that a is divisible by d if a = kd for any integer k)
If and only if
a | a and 1 | a
then a is a prime number
Division Theorem
a
n  +
 q r   | 0  r &lt; n and a = qn + r
r = a mod n
(r = a % n)
q = a / n
if n | a then r = 0
Some examples of the modulus operator:
3%7=3
10 % 7 = 3
17 % 7 = 3
-4 % 7 = 3
to find the modulus of a negative number:
[a]n = { a + kn : n   }
b   iff b  a % n
-1  (n – 1) mod n
Encryption Code
Caesar Code
An example of Caesar code:
Encryption code: (Mi – 3) % 26
The decryption algorithm is the inverse of the encryption code, so:
Decryption code: (Ci + 3) % 26
Message M = C S C I
Ciphertext C = Z P Z F
An example of how encryption is used today:
Alice has a public key PA and a secret key SA.
Bob has a public key PB and a secret key SB.
M = SA(PA(M))
M = PA(SA(M))
If Bob wanted to send a message to Alice, he would have to:
(1) Get PA
(2) C = PA(M) and send C to Alice
(3) M = SA(C)
This type of encryption is to make sure important information (i.e. bank account
information, social security numbers, etc.) is only viewable by the intended target and if
the message is intercepted, it is just a random jumble of things and is not any discernable
message.
There is another kind of encryption known as digital signatures. This is used to verify
that the sender of the message is indeed who they claim to be.
Ex.
C = PA(SB(M))
M = PB(SA(C))
The most popular encryption algorithm at the moment is RSA, named after its
developers, Rivest, Shamir, and Adleman. Its encryption function multiplies large prime
numbers together, and because the factor cannot be found in any real amount of time, it is
impossible to break the code. RSA is popular because it is very scalable. Because the
processing speed of CPUs on the market increases at an incredible pace, operations that
were nearly impossible to complete in the past are easy finished. Thus, as computers
become faster, the prime numbers RSA uses are larger also.
```