Chapter1 -Introduction & Number Theory
Chapter1 -Introduction & Number Theory
Introduction and
Number Theory
A THREAT IS ANY POTENTIAL A VULNERABILITY IS A WEAKNESS THAT AN ATTACK IS AN ACTION THAT EXPLOITS A
OCCURRENCE, MALICIOUS OR MAKES A THREAT POSSIBLE. THIS MAY VULNERABILITY OR ENACTS A THREAT.
OTHERWISE, THAT COULD HARM AN BE BECAUSE OF POOR DESIGN, EXAMPLES OF ATTACKS INCLUDE SENDING
ASSET. IN OTHER WORDS, A THREAT IS CONFIGURATION MISTAKES, OR MALICIOUS INPUT TO AN APPLICATION OR
ANY BAD THING THAT CAN HAPPEN TO INAPPROPRIATE AND INSECURE CODING FLOODING A NETWORK IN AN ATTEMPT TO
DENY SERVICE.
YOUR ASSETS. TECHNIQUES.
2. For example, a file transferred through the Internet may contain confidential
information. An unauthorized entity may intercept the transmission and use the
contents for her own benefit.
❑Traffic Analysis
2. For example, she can find the electronic address (such as the e-mail address) of
the sender or the receiver. She can collect pairs of requests and responses to help
her guess the nature of transaction.
Modification: After intercepting Masquerading: Masquerading, or Replaying: The attacker Repudiation: Repudiation occurs
or accessing information, the spoofing, happens when the attacker obtains a copy of a message when a user or entity denies having
attacker modifies the impersonates somebody else. sent by a user and later tries performed an action, and there's
information to make it Examples: Email spoofing to send to replay it. Examples: insufficient evidence to prove
beneficial to herself. Examples: messages appearing to be from Replaying authentication otherwise. Examples: Denying
Changing the amount on trusted sources, DNS spoofing to credentials, Resending having sent a particular message or
financial transactions, Altering redirect users to malicious websites. financial transactions. email, Claiming a transaction was
database records. unauthorized.
In active attacks, the attacker intercepts the In passive attacks, the attacker observes the
Definition connection and efforts to modify the message's messages, then copy and save them and can use it for
content. malicious purposes.
In active attacks, the victim gets notified about Unlike active attacks, in passive attacks, victims do not
Victim
the attack. get informed about the attack.
Hacker modifies the message from Bob to Alice
In active attacks, the system resources can be In passive attacks, the system resources remain
System resources
changed. unchanged.
They are dangerous for the integrity and They can be dangerous for confidentiality of the
Dangerous for
availability of the message. message.
Active attacks are tough to restrict from Unlike active attacks, passive attacks are easy to
Prevention entering systems or networks. prohibit.
❖ Data Integrity
1. The data integrity mechanism appends to the data a short checkvalue that has been created by a
specific process from the data itself.
2. The receiver receives the data and the checkvalue. He creates a new checkvalue from the received
data and compares the newly created checkvalue with the one received.
3. If the two checkvalues are the same, the integrity of data has been preserved.
Plaintext 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
→ 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
Value → 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
For Decryption,
Encryption Process:
1.Convert the plaintext and key into their binary ASCII representations.
2.Perform the XOR operation between each pair of corresponding bits.
3.Convert the resulting binary back into characters for the ciphertext.
1.Plaintext: "HELLO"
2.Key (randomly generated): "XMCKL" (same length as the plaintext)
3.Encryption: Convert each letter of the plaintext and key into their binary equivalents (ASCII or Unicode
values):
1. Plaintext: H = 72, E = 69, L = 76, L = 76, O = 79
2. Key: X = 88, M = 77, C = 67, K = 75, L = 76
4.Perform a bitwise XOR (exclusive OR) between each pair of corresponding characters:
16 XOR 88 = 72 (H)
8 XOR 77 = 69 (E)
15 XOR 67 = 76 (L)
3 XOR 75 = 76 (L)
3 XOR 76 = 79 (O)
❖ Note that at the end of the message we have inserted two "X"s. These are called nulls, and act
as placeholders.
❖ We do this to make the message fit neatly into the grid (so that there are the same number of
letters on the top row, as on the bottom row.
❖Although not necessary, it makes the decryption process a lot easier if the message has this
layout.
❖ The ciphertext is read off row by row to get "DNETLEEDHESWLXFTAAX".
3.Repeat the process: Continue applying the Columnar Transposition Cipher with different keywords until the
desired number of rounds is reached.
4.Decrypting: Decryption is simply the reverse process, where you decrypt the ciphertext in reverse order of the
encryption rounds and use the corresponding keywords in reverse order.
Examples:
Are 15 and 28 relatively prime?
Yes, gcd(15, 28) = 1.
Are 55 and 28 relatively prime?
Yes, gcd(55, 28) = 1.
Are 35 and 28 relatively prime?
No, gcd(35, 28) = 7.
Examples:
The least common multiple of the positive integers a and b is the smallest positive integer that is
divisible by both a and b. We denote the least common multiple of a and b by lcm(a, b).
Examples:
lcm(3, 7) = 21
lcm(4, 6) = 12
lcm(5, 10) = 10
b = 54 = 21 33 50
b = 54 = 21. 33 50
gcd(a, b) = 21 31 50 =6
lcm(a, b) = 22 33 51 = 540
Examples: 9 mod 4 = 1
9 mod 3 = 0
9 mod 10 = 9
-13 mod 4 = 3
In other words:
a ≡ b (mod m) if and only if a mod m = b mod m.
So we divide 14 by 7:
14 = 7⋅2 + 0
We find that 7 divides 14, and thus gcd(14, 7) = 7.
Example:
3+4=7, but since 7 is too big, we subtract 5 to "wrap it around," so 3+4=2.
Example:
3×4=12, but 12 is too big, so we divide by 5 and take the remainder: 3×4=2.
This keeps everything inside the set {0,1,2,3,4}.
Field)
3.Computer Science:
Used in hash functions, pseudo-random number generators, and computational algebra.
ap-1 ≡1 (mod p)
This means that when a is raised to the power p−1, and divided by p, the remainder is
always 1.