Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ic:laboratoare:02 [2020/10/07 20:26]
acosmin.maria
ic:laboratoare:02 [2020/10/19 14:38] (current)
acosmin.maria
Line 10: Line 10:
   * **ex1.py**: implementation of exercise 1;   * **ex1.py**: implementation of exercise 1;
   * **ex2.py**: implementation of exercise 2;   * **ex2.py**: implementation of exercise 2;
-  * **ex3.py**: implementation of exercise 3; +  * **ex3.py**: implementation of exercise 3. 
-  * **ex4.py**: implementation of exercise 4.+
 You need to fill in the TODOs from **ex1.py**, **ex2.py**, and **ex3.py**. You need to fill in the TODOs from **ex1.py**, **ex2.py**, and **ex3.py**.
  
Line 51: Line 51:
 using the substitution cipher, and that again the plaintext consists only of the English letters **A** to **Z** (all capitals, no punctuation). Try to help Charlie to decrypt this. using the substitution cipher, and that again the plaintext consists only of the English letters **A** to **Z** (all capitals, no punctuation). Try to help Charlie to decrypt this.
  
-Hint: use the frequency analysis mechanisms we discussed in class. Note that the frequency of each letter does not map precisely. In particular, the most frequent two letters do match well with the given table, but the others are sometimes mixed. However, Charlie knows that the most frequent bi-grams are the following (from most frequent to less frequent):+**Hint:** use the frequency analysis mechanisms we discussed in class. Note that the frequency of each letter does not map precisely. In particular, the most frequent two letters do match well with the given table, but the others are sometimes mixed. However, Charlie knows that the most frequent bi-grams are the following (from most frequent to less frequent):
 **TH**, **HE**, **IN**, **OR**, **HA**, **ET**, **AN**, **EA**, **IS**, **OU**, **HI**, **ER**, **ST**, **RE**, **ND** **TH**, **HE**, **IN**, **OR**, **HA**, **ET**, **AN**, **EA**, **IS**, **OU**, **HI**, **ER**, **ST**, **RE**, **ND**
  
Line 96: Line 96:
 ==== Bonus: Exercise 4 (2p) ==== ==== Bonus: Exercise 4 (2p) ====
  
-In class, we explained that the one-time pad is malleable (i.e. we can easily change the encrypted plaintext by simply modifying the ciphertext). We have also discussed how the CRC was a very bad idea in the design of WEP due to its linearity.+In class, we explained that the One Time Pad is malleable (i.e. we can easily change the encrypted plaintext by simply modifying the ciphertext). We have also discussed how the CRC was a very bad idea in the design of WEP due to its linearity.
  
 You are given the following ciphertext in hexadecimal:​ You are given the following ciphertext in hexadecimal:​
Line 116: Line 116:
  
 def main(): def main():
- 
-    cipher = '​021e0e061d1694c9'​ 
-    crc_s1 = '​8e31'​ 
  
     # Plaintexts     # Plaintexts
     s1 = '​floare'​     s1 = '​floare'​
     s2 = '​albina'​     s2 = '​albina'​
- 
-    s1_xor_s2 = strxor(s1, s2) 
-    crc_s2 = '​54ba' ​ # hex_xor(crc_s1,​ crc_s1_xor_s2) 
- 
     G = '' ​ # To find     G = '' ​ # To find
-    C1 = cipher[:-4] 
-    C2 = cipher[-4:] 
  
     # Obtain crc of s1     # Obtain crc of s1
ic/laboratoare/02.1602091610.txt.gz · Last modified: 2020/10/07 20:26 by acosmin.maria
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0