This shows you the differences between two versions of the page.
ic:labs:02 [2021/10/08 16:16] razvan.smadu [Laboratorul 02 - Shift and Vigenère Ciphers] |
ic:labs:02 [2023/10/09 19:15] (current) razvan.smadu |
||
---|---|---|---|
Line 3: | Line 3: | ||
Prezentarea PowerPoint pentru acest laborator poate fi găsită [[https://drive.google.com/file/d/1rbiXVtSESTDc2rAyaO9oNRNLE3NRw54a/view?usp=sharing|aici]]. | Prezentarea PowerPoint pentru acest laborator poate fi găsită [[https://drive.google.com/file/d/1rbiXVtSESTDc2rAyaO9oNRNLE3NRw54a/view?usp=sharing|aici]]. | ||
- | Pentru acest laborator, vom avea nevoie de scheletul de cod care se găsește aici: {{:ic:res:lab2_sketch.zip|}} | + | Puteți lucra acest laborator folosind platforma Google Colab, accesând [[https://colab.research.google.com/github/ACS-IC-labs/IC-labs/blob/main/labs/lab02/lab2.ipynb|acest]] link. |
+ | |||
+ | <hidden> | ||
+ | Pentru acest laborator, vom avea nevoie de scheletul de cod care se găsește aici: {{:ic:res:lab2_sketch.zip|}}. | ||
Conținutul arhivei: | Conținutul arhivei: | ||
- | * **format_funcs.py**: funcțiile de formatare din laboratorul anterior; | + | * **utils.py**: funcțiile de formatare din laboratorul anterior; |
* **caesar.py**: implementarea funcțiilor de criptare și decriptare folosind Cifrul Cezar, din laboratorul anterior; | * **caesar.py**: implementarea funcțiilor de criptare și decriptare folosind Cifrul Cezar, din laboratorul anterior; | ||
* **msg_ex1.txt**: textele care trebuie decriptate pentru exercițiul 1; | * **msg_ex1.txt**: textele care trebuie decriptate pentru exercițiul 1; | ||
Line 113: | Line 116: | ||
Poate găsiți acest început de script util: | Poate găsiți acest început de script util: | ||
<code python ex4_draft.py> | <code python ex4_draft.py> | ||
- | from format_funcs import * | + | from utils import * |
def main(): | def main(): | ||
- | |||
# Plaintexts | # Plaintexts | ||
- | s1 = 'floare' | + | s1 = "floare" |
- | s2 = 'albina' | + | s2 = "albina" |
- | G = '' # To find | + | G = "" # To find |
# Obtain crc of s1 | # Obtain crc of s1 | ||
Line 129: | Line 131: | ||
x2 = str_2_hex(s2) | x2 = str_2_hex(s2) | ||
print("x1: " + x1) | print("x1: " + x1) | ||
- | crc1 = '8E31' # CRC-16 of x1 | + | crc1 = "8E31" # CRC-16 of x1 |
# Compute delta (xor) of x1 and x2: | # Compute delta (xor) of x1 and x2: | ||
xd = hexxor(x1, x2) | xd = hexxor(x1, x2) | ||
print("xd: " + xd) | print("xd: " + xd) | ||
+ | |||
+ | # TODO: | ||
Line 145: | Line 149: | ||
Dacă d = 'floare' XOR 'albina', iar C = [C1 | C2] = [m XOR G1 | CRC(m) XOR G2], atunci C1' = C1 XOR d. | Dacă d = 'floare' XOR 'albina', iar C = [C1 | C2] = [m XOR G1 | CRC(m) XOR G2], atunci C1' = C1 XOR d. | ||
</note> | </note> | ||
+ | </hidden> |