
    

    <?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2-ppt DokuWiki" -->
<?xml-stylesheet href="http://ocw.cs.pub.ro/courses/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="http://ocw.cs.pub.ro/courses/feed.php">
        <title>CS Open CourseWare ic:labs</title>
        <description></description>
        <link>http://ocw.cs.pub.ro/courses/</link>
        <image rdf:resource="http://ocw.cs.pub.ro/courses/lib/tpl/arctic/images/favicon.ico" />
       <dc:date>2026-05-14T08:19:18+03:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/01?rev=1772172436&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/01_en?rev=1633184580&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/02?rev=1772456497&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/02_en?rev=1633183184&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/03?rev=1697478788&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/03_en?rev=1633702407&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/04?rev=1696882916&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/04_en?rev=1634224867&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/05?rev=1696882934&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/05_en?rev=1635688697&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/06?rev=1696882960&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/06_en?rev=1636315610&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/07?rev=1696882975&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/07_en?rev=1636871905&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/08?rev=1700607803&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/08_en?rev=1638552981&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/09?rev=1696882995&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/09_en?rev=1633069414&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/10?rev=1696883013&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/10_en?rev=1633118363&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/11?rev=1604592667&amp;do=diff"/>
                <rdf:li rdf:resource="http://ocw.cs.pub.ro/courses/ic/labs/12?rev=1604592701&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="http://ocw.cs.pub.ro/courses/lib/tpl/arctic/images/favicon.ico">
        <title>CS Open CourseWare</title>
        <link>http://ocw.cs.pub.ro/courses/</link>
        <url>http://ocw.cs.pub.ro/courses/lib/tpl/arctic/images/favicon.ico</url>
    </image>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/01?rev=1772172436&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2026-02-27T08:07:16+03:00</dc:date>
        <title>Laboratorul 01 - Introducere</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/01?rev=1772172436&amp;do=diff</link>
        <description>Laboratorul 01 - Introducere

Puteți lucra acest laborator folosind și platforma Google Colab, accesând acest link, cu excepția exercițiului bonus și eventual 0/0b. Un scurt tutorial pentru utilizarea platformei poate fi găsit aici. 

Python3 Crash Course

Tutorialul poate fi găsit aici. La laboratoare vom folosi Python 3.10 sau mai nou.</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/01_en?rev=1633184580&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-10-02T17:23:00+03:00</dc:date>
        <title>Laboratorul 01 - Introduction</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/01_en?rev=1633184580&amp;do=diff</link>
        <description>Laboratorul 01 - Introduction

Python3 Crash Course

Check-out this tutorial: here.

Encoding vs Encryption

Encoding

	*  Is used to transform data from one format to another.
	*  Typically used in data transfer between different systems.
	*  The information is NOT kept secret!!!
	*  To decode the encoded data you only need to know the algorithm that was used.</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/02?rev=1772456497&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2026-03-02T15:01:37+03:00</dc:date>
        <title>Laboratorul 02 - Shift and Vigenère Ciphers</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/02?rev=1772456497&amp;do=diff</link>
        <description>Laboratorul 02 - Shift and Vigenère Ciphers

Prezentarea PowerPoint pentru acest laborator poate fi găsită aici.

Puteți lucra acest laborator folosind platforma Google Colab, accesând acest link.



	*  utils.py: funcțiile de formatare 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_ex2.txt: textele care trebuie decriptate pen…</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/02_en?rev=1633183184&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-10-02T16:59:44+03:00</dc:date>
        <title>Laboratorul 02 - Shift and Vigenère Ciphers</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/02_en?rev=1633183184&amp;do=diff</link>
        <description>Laboratorul 02 - Shift and Vigenère Ciphers

The powerpoint presentation for this lab can be found here.

Please download the lab skeleton from here: 
The archive contains the following:

	*  format_funcs.py: the format functions from the previous lab;
	*  caesar.py: the implementation of the Caesar encryption and decryption from the previous lab;
	*  msg_ex1.txt: the text which needs to be decrypted for exercise 1;
	*  msg_ex2.txt: the text which needs to be decrypted for exercise 2;
	*  msg_ex…</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/03?rev=1697478788&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2023-10-16T20:53:08+03:00</dc:date>
        <title>Laboratorul 03 - PRGs</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/03?rev=1697478788&amp;do=diff</link>
        <description>Laboratorul 03 - PRGs

Prezentarea PowerPoint pentru acest laborator poate fi găsită aici. Puteți găsi o scurtă prezentare a noțiunii de avantaje în acest PDF.

Puteți lucra acest laborator folosind platforma Google Colab, accesând acest link.</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/03_en?rev=1633702407&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-10-08T17:13:27+03:00</dc:date>
        <title>Laboratorul 03 - PRGs</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/03_en?rev=1633702407&amp;do=diff</link>
        <description>Laboratorul 03 - PRGs

The powerpoint presentation for this lab can be found here.


import base64

# CONVERSION FUNCTIONS

def _chunks(string, chunk_size):
    for i in range(0, len(string), chunk_size):
        yield string[i:i+chunk_size]

def _hex(x):
    return format(x, '02x')

def hex_2_bin(data):
    return ''.join(f'{int(x, 16):08b}' for x in _chunks(data, 2))

def str_2_bin(data):
    return ''.join(f'{ord(c):08b}' for c in data)

def bin_2_hex(data):
    return ''.join(f'{int(b, 2):02…</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/04?rev=1696882916&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2023-10-09T23:21:56+03:00</dc:date>
        <title>Laboratorul 04 - PRFs, PRPs, SPNs</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/04?rev=1696882916&amp;do=diff</link>
        <description>Laboratorul 04 - PRFs, PRPs, SPNs

Prezentarea PowerPoint pentru acest laborator poate fi găsită aici.

Puteți lucra acest laborator folosind platforma Google Colab, accesând acest link.


import base64
from typing import Generator


def _pad(data: str, size: int) -&gt; str:
    reminder = len(data) % size
    if reminder != 0:
        data = &quot;0&quot; * (size - reminder) + data
    return data


def _chunks(data: str, chunk_size: int) -&gt; Generator[str, None, None]:
    data = _pad(data, chunk_size)
    …</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/04_en?rev=1634224867&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-10-14T18:21:07+03:00</dc:date>
        <title>Laboratorul 04 - PRFs, PRPs, SPNs</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/04_en?rev=1634224867&amp;do=diff</link>
        <description>Laboratorul 04 - PRFs, PRPs, SPNs

The powerpoint presentation for this lab can be found here.


import base64

# CONVERSION FUNCTIONS
def _chunks(string, chunk_size):
    for i in range(0, len(string), chunk_size):
        yield string[i:i+chunk_size]

# THIS ONE IS NEW
def byte_2_bin(bval):
    &quot;&quot;&quot;
      Transform a byte (8-bit) value into a bitstring
    &quot;&quot;&quot;
    return bin(bval)[2:].zfill(8)

def _hex(x):
    return format(x, '02x')

def hex_2_bin(data):
    return ''.join(f'{int(x, 16):08b}'…</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/05?rev=1696882934&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2023-10-09T23:22:14+03:00</dc:date>
        <title>Laboratorul 05 - DES</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/05?rev=1696882934&amp;do=diff</link>
        <description>Laboratorul 05 - DES

În acest laborator vom face niște exerciții ce folosesc algoritmul DES și variații ale acestuia discutate la curs.
Prezentarea PowerPoint pentru acest laborator poate fi găsită aici.
Puteți lucra acest laborator folosind platforma Google Colab, accesând acest link.</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/05_en?rev=1635688697&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-10-31T15:58:17+03:00</dc:date>
        <title>Laboratorul 05 - DES</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/05_en?rev=1635688697&amp;do=diff</link>
        <description>Laboratorul 05 - DES

In this lab we'll do some exercises with DES and some of its variants, as we discussed in the last lecture here. Also, you can check this presentation for this lab.


import base64
 
# CONVERSION FUNCTIONS
def _chunks(string, chunk_size):
    for i in range(0, len(string), chunk_size):
        yield string[i:i+chunk_size]
 
def byte_2_bin(bval):
    &quot;&quot;&quot;
      Transform a byte (8-bit) value into a bitstring
    &quot;&quot;&quot;
    return bin(bval)[2:].zfill(8)
 
def _hex(x):
    return …</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/06?rev=1696882960&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2023-10-09T23:22:40+03:00</dc:date>
        <title>Laboratorul 06 - AES Byte at a Time ECB Decryption</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/06?rev=1696882960&amp;do=diff</link>
        <description>Inainte de laborator: Video Laborator 6

Laboratorul 06 - AES Byte at a Time ECB Decryption

Prezentarea PowerPoint pentru acest laborator poate fi găsită aici.

Puteți lucra acest laborator folosind platforma Google Colab, accesând acest link.


import base64
from typing import Generator


def _pad(data: str, size: int) -&gt; str:
    reminder = len(data) % size
    if reminder != 0:
        data = &quot;0&quot; * (size - reminder) + data
    return data


def _chunks(data: str, chunk_size: int) -&gt; Generato…</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/06_en?rev=1636315610&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-11-07T22:06:50+03:00</dc:date>
        <title>Laboratorul 06 - AES Byte at a Time ECB Decryption</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/06_en?rev=1636315610&amp;do=diff</link>
        <description>Inainte de laborator: Video Laborator 6

Laboratorul 06 - AES Byte at a Time ECB Decryption

The powerpoint presentation for this lab can be found here.


import base64
 
# CONVERSION FUNCTIONS
def _chunks(string, chunk_size):
    for i in range(0, len(string), chunk_size):
        yield string[i:i+chunk_size]

def byte_2_bin(bval):
    &quot;&quot;&quot;
      Transform a byte (8-bit) value into a bitstring
    &quot;&quot;&quot;
    return bin(bval)[2:].zfill(8)
 
def _hex(x):
    return format(x, '02x')
 
def hex_2_bin(da…</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/07?rev=1696882975&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2023-10-09T23:22:55+03:00</dc:date>
        <title>Laboratorul 07 - Correlation Power Analysis</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/07?rev=1696882975&amp;do=diff</link>
        <description>Laboratorul 07 - Correlation Power Analysis

Prezentarea PowerPoint pentru acest laborator poate fi găsită aici. Puteți lucra acest laborator folosind platforma Google Colab, accesând acest link.
Correlation Power Analysis


	*  Se alege un target din algoritm pentru a fi atacat (în general output-ul unui S-box folosit de un block cipher – în cazul nostru fiind AES)
	*  Se obține un număr mare de sample-uri de leakage de la target când acesta procesează diferite plaintext-uri
	*  Se alege un mod…</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/07_en?rev=1636871905&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-11-14T08:38:25+03:00</dc:date>
        <title>Laboratorul 07 - Correlation Power Analysis</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/07_en?rev=1636871905&amp;do=diff</link>
        <description>Laboratorul 07 - Correlation Power Analysis

The powerpoint presentation for this lab can be found here.

In this lab we'll implement a side-channel attack known as Correlation Power Analysis.

The principle is quite simple:

	*  Choose your target (generally the S-box output of some block cipher - in our case AES)
	*  Obtain a large number (thousands) of leakage samples for that target, when processing different plaintexts
	*  Choose a suitable leakage model (usually the hamming weight of the t…</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/08?rev=1700607803&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2023-11-22T01:03:23+03:00</dc:date>
        <title>Laboratorul 08 - MAC</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/08?rev=1700607803&amp;do=diff</link>
        <description>Laboratorul 08 - MAC

Prezentarea PowerPoint pentru acest laborator poate fi găsită aici.

Exercițiul 1 - OpenSSL în linia de comanda (3p)

OpenSSL este o suita de funcții criptografice, care oferă atât o facilitate de unelte în linie de comandă
cât și o librărie folosită pentru aplicații (e.g. C/Python). Aici vom face câteva exerciții cu OpenSSL
în linie de comandă ca să pridenți ceva experiență cu aceste funcții foarte populare și utile.</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/08_en?rev=1638552981&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-12-03T19:36:21+03:00</dc:date>
        <title>Laboratorul 08 - MACs</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/08_en?rev=1638552981&amp;do=diff</link>
        <description>Laboratorul 08 - MACs

The powerpoint presentation for this lab can be found here.

In this lab we'll do some exercises with Message Authentication Codes.

Exercise 1 - Existential Unforgeability

In this exercise we will attack an insecure MAC algorithm by showing that an adversary can forge a (message, tag) pair without first querying a  oracle with the message.</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/09?rev=1696882995&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2023-10-09T23:23:15+03:00</dc:date>
        <title>Laboratorul 09 - OpenSSL MACs, Hashes and AEAD</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/09?rev=1696882995&amp;do=diff</link>
        <description>Laboratorul 09 - OpenSSL MACs, Hashes and AEAD

Prezentarea PowerPoint pentru acest laborator o puteți găsi aici. Puteți lucra acest laborator folosind platforma Google Colab, accesând acest link.





openssl randopenssl dgst



	*  generați o cheie aleatoare de 16 octeți;
	*  folosiți cheia pentru a calcula un HMAC SHA-1 al mesajului: “Laborator IC”;
	*  folosiți aceeași cheie pentru a calcula un HMAC SHA-1 al mesajului “Laborator IC!”. Observați diferența dintre mesaje - un singur caracter (a…</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/09_en?rev=1633069414&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-10-01T09:23:34+03:00</dc:date>
        <title>Laboratorul 09 - OpenSSL MACs, Hashes and AEAD</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/09_en?rev=1633069414&amp;do=diff</link>
        <description>Laboratorul 09 - OpenSSL MACs, Hashes and AEAD

The powerpoint presentation for this lab can be found here.

Exercise 1

In this exercise we'll use the command line to compute an HMAC, with SHA-1 as the hashing algorithm.

Recall from the lecture that for HMAC to be secure, we need to sample a random key .</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/10?rev=1696883013&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2023-10-09T23:23:33+03:00</dc:date>
        <title>Laboratorul 10 - Prezentul și Viitorul criptării cu chei publice (Public Key Encryption)</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/10?rev=1696883013&amp;do=diff</link>
        <description>Laboratorul 10 - Prezentul și Viitorul criptării cu chei publice (Public Key Encryption)

Prezentarea PowerPoint pentru acest laborator o puteți găsi aici. Puteți lucra acest laborator folosind platforma Google Colab, accesând acest link. 





[aici]</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/10_en?rev=1633118363&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-10-01T22:59:23+03:00</dc:date>
        <title>Laboratorul 10 - Present and Future Public Key Encryption</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/10_en?rev=1633118363&amp;do=diff</link>
        <description>Laboratorul 10 - Present and Future Public Key Encryption

The powerpoint presentation for this lab can be found here.

In this lab we'll do some cool exercises using public key encryption methods for key exchange and data encryption.

Exercise 1: Diffie-Hellman key exchange (4p)

As we discussed in class, Diffie and Hellman proposed the first public key exchange mechanism such that
two parties, that did not share any previous secret could establish a common secret. This allows
the parties to ha…</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/11?rev=1604592667&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-11-05T18:11:07+03:00</dc:date>
        <title>Laboratorul 10 OLD - OpenSSL AEAD</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/11?rev=1604592667&amp;do=diff</link>
        <description>Laboratorul 10 OLD - OpenSSL AEAD

Before you start solving the exercises below, download the [lab archive from here].

Exercise 1

The archive contains the source code for Exercise 2, but sadly it is encrypted. Luckily, we forgot to remove the password file from the archive.</description>
    </item>
    <item rdf:about="http://ocw.cs.pub.ro/courses/ic/labs/12?rev=1604592701&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-11-05T18:11:41+03:00</dc:date>
        <title>Laboratorul 12.</title>
        <link>http://ocw.cs.pub.ro/courses/ic/labs/12?rev=1604592701&amp;do=diff</link>
        <description>Laboratorul 12.</description>
    </item>
</rdf:RDF>
