NUMBER THEORY
[Link] that the cipher text of HOUND using an affine cipher with Key K= (7,3) is AXNQY
E(x) = (a * x + b) mod 26
where 'x' represents the numerical value of the plaintext letter, 'a' and 'b' are the key
components, and 'mod 26' ensures that the result stays within the range of the alphabet (26
letters).
encrypt each letter of the plaintext "HOUND" step by step:
1. H: First, we need to convert 'H' to its numerical equivalent. In English alphabets, 'A' is 0, 'B' is
1, and so on. Therefore, 'H' is 7.
E(7) = (7 * 7 + 3) mod 26 = 52 mod 26 = 0 The numerical value 0 corresponds to the letter 'A'
in the alphabet.
2. O: The numerical equivalent of 'O' is 14.
E(14) = (7 * 14 + 3) mod 26 = 101 mod 26 = 23. The numerical value 23 corresponds to the
letter 'X' in the alphabet.
3. U: The numerical equivalent of 'U' is 20.
E(20) = (7 * 20 + 3) mod 26 = 143 mod 26 = 15. The numerical value 15 corresponds to the
letter 'N' in the alphabet.
4. N: The numerical equivalent of 'N' is 13.
E(13) = (7 * 13 + 3) mod 26 = 94 mod 26 = 16. The numerical value 16 corresponds to the
letter 'Q' in the alphabet.
5. D: The numerical equivalent of 'D' is 3.
E(3) = (7 * 3 + 3) mod 26 = 24 mod 26 = 24. The numerical value 24 corresponds to the letter
'Y' in the alphabet.
Therefore, the ciphertext of "HOUND" using an affine cipher with key K=(7,3) is "AXNQY".
2. Encrypt your full name without special characters or spaces using affine cipher with Key
K=(3,4)
To encrypt the plaintext "JOANSHANEBBUENAFLOR" using an affine cipher with the key K = (3,
4), we need to apply the following encryption formula: E(x) = (a * x + b) mod 26
- Convert each letter of the plaintext to its corresponding number representation:
J O A N S H A N E B
9 14 0 13 18 7 0 13 4 1
B U E N A F L O R
1 20 4 13 0 5 11 14 17
Apply the encryption formula to each number:
E(9) = (3 * 9 + 4) mod 26 = 31 mod 26 = 5 -> F
E(14) = (3 * 14 + 4) mod 26 = 46 mod 26 = 20 -> U
E(0) = (3 * 0 + 4) mod 26 = 4 mod 26 = 4 -> E
E(13) = (3 * 13 + 4) mod 26 = 43 mod 26 = 17 -> R
E(18) = (3 * 18 + 4) mod 26 = 58 mod 26 = 6 -> G
E(7) = (3 * 7 + 4) mod 26 = 25 mod 26 = 25 -> Z
E(0) = (3 * 0 + 4) mod 26 = 4 mod 26 = 4 -> E
E(13) = (3 * 13 + 4) mod 26 = 43 mod 26 = 17 -> R
E(4) = (3 * 4 + 4) mod 26 = 16 mod 26 = 16 -> Q
E(1) = (3 * 1 + 4) mod 26 = 7 mod 26 = 7 -> H
E(1) = (3 * 1 + 4) mod 26 = 7 mod 26 = 7 -> H
E(20) = (3 * 20 + 4) mod 26 = 64 mod 26 = 12 -> M
E(4) = (3 * 4 + 4) mod 26 = 16 mod 26 = 16 -> Q
E(13) = (3 * 13 + 4) mod 26 = 43 mod 26 = 17 -> R
E(0) = (3 * 0 + 4) mod 26 = 4 mod 26 = 4 -> E
E(5) = (3 * 5 + 4) mod 26 = 19 mod 26 = 19 -> T
E(11) = (3 * 11 + 4) mod 26 = 37 mod 26 = 11 -> L
E(14) = (3 * 14 + 4) mod 26 = 46 mod 26 = 20 -> U
E(17) = (3 * 17+ 4) mod 26= 55 mod 26 = 3 -> D
"JOANSHANEBBUENAFLOR" is “ FUERGZERQHHMQRETLUD”
3. Decrypt the ciphertext "YATJ" if an affine cipher with key K=(11, 2) was used for encryption.
The decryption key for an affine cipher is found by calculating the multiplicative inverse of the
key's first element (a) modulo 26. In this case, the first element of the key is 11. To find the
multiplicative inverse of 11 modulo 26, we need to find a value x such that:
11 * x ≡ 1 (mod 26)
To solve this congruence equation, we can try different values of x until we find a solution. In
this case, the multiplicative inverse of 11 modulo 26 is 19, as:
11 * 19 ≡ 1 (mod 26) Now, let's use the decryption key (a^-1, b) = (19, 2) to decrypt the
ciphertext "YATJ".
To decrypt each letter, we'll apply the following formula: P = (a^-1 * (C - b)) mod 26
where P is the plaintext letter, C is the ciphertext letter, a^-1 is the multiplicative inverse of a,
and b is the key element.
For each letter in the ciphertext "YATJ":
1. Decrypt 'Y':
P = (19 * (24 - 2)) mod 26
P = (19 * 22) mod 26
P = 18
The plaintext letter corresponding to 18 is 'S'.
2. Decrypt 'A':
P = (19 * (0 - 2)) mod 26
P = (19 * (-2)) mod 26
P = 12
The plaintext letter corresponding to 12 is 'M'.
3. Decrypt 'T':
P = (19 * (19 - 2)) mod 26
P = (19 * 17) mod 26
P=3
The plaintext letter corresponding to 3 is 'C'.
4. Decrypt 'J':
P = (19 * (9 - 2)) mod 26
P = (19 * 7) mod 26
P=7
The plaintext letter corresponding to 7 is 'H'.
Therefore, the decrypted plaintext for the ciphertext "YATJ" using the affine cipher with key
K=(11, 2) is "SMCH".
4. The shift cipher can be represented using an affine cipher. What value of a and b do you
need for this?
The shift cipher is a special case of the affine cipher where the key (a, b) is (1, b). In the shift
cipher, the encryption process involves shifting each letter in the plaintext by a fixed number of
positions in the alphabet, which is represented by the value of b.
For example, if b is 3, each letter in the plaintext is shifted three positions to the right in the
alphabet. Similarly, if b is -2, each letter is shifted two positions to the left.
Therefore, to represent the shift cipher using an affine cipher, we would use the key (a, b) = (1,
b), where 'a' is 1 (indicating no multiplicative transformation) and 'b' represents the shift value.
In conclusion, for the shift cipher, you would need the values of a = 1 and b = the desired shift
value.
5. Using Vigenere cipher to decrypt the following messages:
a. Alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
Key: 2days
Cipher text: 60P2YL600460
b. Alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZ Key: MATH
Cipher text: BALZFHBZEUUQQCM
To decrypt the given messages using the Vigenere cipher, you need to apply the reverse process.
Here's how you can decrypt each message:
a. Alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
Key: 2days
Cipher text: 60P2YL600460
To decrypt the cipher text, you need to subtract the corresponding key letter from each cipher
text letter.
1. Convert the key and cipher text letters to their corresponding numerical values based on
the given alphabet:
2 D A Y S
0 3 0 24 18
- Cipher text: 6-6, 0-0, P-15, 2-2, Y-24, L-11, 6-6, 0-0, 0-0, 4-4, 6-6, 0-0
Subtract the numerical key values from the corresponding cipher text values (mod 36):
- Decrypted numerical values: 6, -3, 15, -22, 6, 11, 0, 0, -4, -2, 6, 0
Convert the decrypted numerical values back to their corresponding alphabet letters:
- Decrypted message: 6, M, 15, G, 6, L, A, A, 2, 34, 6, 0
The decrypted message is: 6M15G6LA2Y46A0 (with "Y" replaced by "34").
b. Alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZ
Key: MATH
Cipher text: BALZFHBZEUUQQCM
Convert the key and cipher text letters to their corresponding numerical values based on the
given alphabet:
- Key: M-12, A-0, T-19, H-7
- Cipher text: B-1, A-0, L-11, Z-25, F-5, H-7, B-1, Z-25, E-4, U-20, U-20, Q-16, Q-16, C-2, M-12
Subtract the numerical key values from the corresponding cipher text values (mod 26):
- Decrypted numerical values: 15, 0, 18, 18, 19, 7, 15, 25, 11, 13, 20, 0, 0, 0, 0
Convert the decrypted numerical values back to their corresponding alphabet letters:
- Decrypted message: O, A, R, R, S,
7. Decrypt the four-word encrypted message
54 428 085
29 553 642
38 882 922
26 213 581
Given: Public key (n=62 615 533, e=5)
[Link] wants to send a message to Alice using the RSA Cryptosystem, so she tells him that her
encoding exponent is e-17 and her encoding modulus is n=7919. Show Bob how to encode the
message ILOVEYOU
Encoding the message "ILOVEYOU" using RSA:
To encode the message "ILOVEYOU" using RSA, we need Alice's encoding exponent (e) and
encoding modulus (n). Alice has informed Bob that her encoding exponent is e-17 and her
encoding modulus is n = 7,919.
First, we need to convert the message into a numerical representation. We can use ASCII values
for each character:
I L O V E Y O U
73 76 79 86 69 89 79 85
The encoded message is:
5,746 6,705 2,356 1,114 1,650 2,153 2,356 4,196
9. Your mission (should you choose to accept it) is to encrypt your response using at least three
different cryptosystems. Write your response on a separate piece of paper. (Note: The response
should be minimum of 5 words.)
The message is from your ex-boyfriend/girlfriend:
THE WEDDING BEGINS AT NOON. COME AND JOIN US!
a) Caesar Cipher encryption:
Given message: THE WEDDING BEGINS AT NOON. COME AND JOIN US!
Shift: 3
Encrypted message: WKH ZHGGLQJ EHIILQ DW QRRL. FRPH DQG MRXU VW!
b) Vigenère Cipher encryption:
Given message: THE WEDDING BEGINS AT NOON. COME AND JOIN US!
Keyword: SECRET
Encrypted message: ZTG QVGQDC ZRHJUV DG RFEE. MVME DQF YOJK XH!
c) Playfair Cipher encryption:
Given message: THE WEDDING BEGINS AT NOON. COME AND JOIN US!
Key: PLAYFAIR
Encrypted message: VFI VYBNJEP YLILNR FR RNYW. UGEC DQJ XRDO WH!