Math/Cs 348 Crypto Exercise In this exercise, we will demonstrate a simple examp
ID: 3820555 • Letter: M
Question
Math/Cs 348 Crypto Exercise In this exercise, we will demonstrate a simple example of using modular arithmetic in a cryptosystem. The system we will use is small eno to do all of the computations by ough hand, and it is easily broken by brute force. However it will demonstrate some fundamental n this system, we will represent characters with 5 bits. Since 2 32, we can represent 32 characters. Since we only have 26 letters, that lets us add 6 more characters. We will represent characters as numbers less than 32 with this correspondence: a 0 i 8 q 16 y 24 b 1 j 9 r 17 z 25 c 2 k 10 s 18 26 d 3 11 t 19 27 e 4 m 12 u 20 28 f 5 n 13 v 21 29 g 6 o 14 w 22 & 30 h 7 p 15 x 23 31 As we describe this system, we will encrypt the plaintext message example First, if there are any spaces in the example, replace every space with The system we will use will be applied to blocks of 4 characters each, so we need to make sure that the number of characters in our plaintext is a multiple of 4. The word "example" is only 7 characters, so we pad our message with a dummy character: examplex Next, we divide our message in to blocks of 4 characters: exam I plex Next, we convert our characters to numbers using the correspondence above: 4 23 012 l 15 11 4 23 Now we convert each number to binary (giving 5 bits for each character). 00100 10111 00000 01100 l 01111 01011 00100 10111 Now we will diffuse the information from each character across 4 characters by applying a transposition to the bits 4 character block. Imagine the bits in each block are numbered from left to right from 0 to 19. Collect all of the even numbered bits together and then all of the odd numbered bits together like so:Explanation / Answer
1)
i-am = 8 27 0 12
converting to binary
01000 11000 00000 011000
now taking odd places together and even places together we get
00011000100101010000
random sequence we get x0=9 and c= 7
is
9 3 16 24
converting this to binary
01001 00011 10000 11000
adding these two
00011000100101010000
+ 01001000111000011000
-------------------------------------
01100001011101101000
01100 00101 11011 0100
converting back to decimal
12 5 27 8
= "uf-q"
Ans: "uf-q"
2)
To decrypt
pwy.
pwy. = 15 22 24 29
we conver it to binary
01111 10110 11000 11101
we generate the random sequence using x0=9 c=7
we get
9 3 16 24
binary= 01001 00011 10000 11000
we subtract the random sequence binary from encrypted binary
01111101101100011101
-01001000111000011000
-------------------------------------
00110100110100000101
now we get the mod 2 value = 00110100110100000101
we place back the odd and even
first 10 values are odd and would go in 1,3,5,7,9 ans so on till 19th position
next ten are even values which would go in 2,4,6,8 and so on till 20th position
the final binary would be
after interchanging the positions
00011 01000 10000 11011
= 3 8 16 27
decrypted value = "diq-"
ans:- "diq-"
thumbs up if i helped you .