{"id":26984171,"url":"https://github.com/eliainnocenti/cryptography-exercises","last_synced_at":"2026-05-05T07:31:53.381Z","repository":{"id":282421555,"uuid":"942477145","full_name":"eliainnocenti/Cryptography-Exercises","owner":"eliainnocenti","description":"Exercises for Cryptography Exam @ Polito - Cryptographic primitives in C with OpenSSL and prototype attacks in Python.","archived":false,"fork":false,"pushed_at":"2025-07-13T13:39:14.000Z","size":839,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-13T15:33:59.656Z","etag":null,"topics":["asymmetric-cryptography","c","cryptography","ctf","digest","encryption-decryption","offensive-security","openssl","python","rand","random-number-generators","random-numbers","symmetric-cryptography"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eliainnocenti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-04T06:57:54.000Z","updated_at":"2025-07-13T13:39:17.000Z","dependencies_parsed_at":"2025-04-18T10:14:57.798Z","dependency_job_id":"6578e144-25cb-4128-918e-f6542321387f","html_url":"https://github.com/eliainnocenti/Cryptography-Exercises","commit_stats":null,"previous_names":["eliainnocenti/cryptography-exercises"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eliainnocenti/Cryptography-Exercises","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eliainnocenti%2FCryptography-Exercises","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eliainnocenti%2FCryptography-Exercises/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eliainnocenti%2FCryptography-Exercises/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eliainnocenti%2FCryptography-Exercises/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eliainnocenti","download_url":"https://codeload.github.com/eliainnocenti/Cryptography-Exercises/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eliainnocenti%2FCryptography-Exercises/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32640533,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"online","status_checked_at":"2026-05-05T02:00:06.033Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asymmetric-cryptography","c","cryptography","ctf","digest","encryption-decryption","offensive-security","openssl","python","rand","random-number-generators","random-numbers","symmetric-cryptography"],"created_at":"2025-04-03T17:35:14.226Z","updated_at":"2026-05-05T07:31:53.375Z","avatar_url":"https://github.com/eliainnocenti.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cryptography Exercises\n\n![polito](resources/logo_polito.jpg)\n\nThis repository contains materials for the **Cryptography** course at **Politecnico di Torino**, focusing on both implementation and attack scenarios to bridge theory and practice.\n\n## Overview\n\nThe exercises are divided into two main parts:\n\n- **C Programming with OpenSSL:**  \n  Learn how to implement cryptographic primitives and protocols in C. Exercises include:\n\n  - **Random Numbers:** Generating cryptographically secure pseudo-random numbers.\n  - **Symmetric Encryption:** Implementing and understanding symmetric ciphers.\n  - **Digests \u0026 MACs:** Working with hash functions and message authentication codes.\n  - **Big Numbers:** Handling large integer arithmetic for crypto applications.\n  - **Asymmetric Cryptography:** Exploring public-key techniques and RSA.\n\n- **Python for Cryptography and Attacks:**  \n  Focus on rapid prototyping, cryptanalysis, and CTF-style challenges. Python is used for both implementing cryptographic primitives and attacking them, making it ideal for practical exploit development and cryptanalysis.\n\n\u003e [!NOTE]\n\u003e For further details, refer to the course slides and materials provided during the lectures.\n\n## Repository Structure\n\nThe repository is organized as follows:\n\n| Section         | Description                                                            |\n| --------------- | ---------------------------------------------------------------------- |\n| **`C/OpenSSL`** | Exercises using C and OpenSSL covering various cryptographic topics.   |\n| **`C/CTFs`**    | Capture The Flag (CTF) challenges implemented in C, focusing on practical cryptographic problems and solutions. |\n| **`Python`**    | Python-based cryptography exercises, attacks, and CTF challenges.      |\n\n### C/OpenSSL\n\nInside the **`C/OpenSSL`** folder, exercises are structured into dedicated directories:\n\n| Exercise                                                                        | Description                                                              |\n| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |\n| [**`Random Numbers`**](C/OpenSSL/01-random-numbers/README.md)                   | Generating cryptographically secure pseudo-random numbers using OpenSSL. |\n| [**`Symmetric Encryption`**](C/OpenSSL/02-symmetric-encryption/README.md)       | Implementing symmetric encryption algorithms with OpenSSL.               |\n| [**`Digests and MACs`**](C/OpenSSL/03-digests-MACs/README.md)                   | Exploring cryptographic digests and MACs.                                |\n| [**`Big Numbers`**](C/OpenSSL/04-big-numbers/README.md)                         | Handling big numbers in cryptographic operations.                        |\n| [**`Asymmetric Cryptography`**](C/OpenSSL/05-asymmetric-cryptography/README.md) | Working with asymmetric cryptography and public key operations.          |\n\n### C/CTFs\n\nInside the **`C/CTFs`** folder, exercises are structured into dedicated directories:\n\n| CTF Challenge                                                                 | Description                                                              |\n| ----------------------------------------------------------------------------- | ------------------------------------------------------------------------ |\n| [**`Rand`**](C/CTFs/rand/README.md)                                           | Bytewise operations on random strings to capture the flag.               |\n| [**`Encryption`**](C/CTFs/enc/README.md)                                      | Various encryption challenges including padding, decryption, and more.   |\n| [**`Digest`**](C/CTFs/dgst/README.md)                                         | Compute keyed digests and modify digest algorithms to capture the flag.  |\n| [**`HMAC`**](C/CTFs/hmac/README.md)                                           | Compute HMAC-SHA256 of two files to capture the flag.                    |\n| [**`Asymmetric`**](C/CTFs/asym/README.md)                                     | Find missing parameters using BIGNUM primitives to capture the flag.     |\n\n### Python\n\nThe **`Python/`** directory has been significantly expanded and now includes a wide range of cryptography exercises, attacks, and CTF-style challenges. The structure is as follows:\n\n#### Basics\n\nThe Basics section provides comprehensive implementations of fundamental cryptographic concepts:\n\n| Exercise/Subdirectory                                                | Description                                                                                    |\n| -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |\n| [**`symmetric/`**](Python/Basics/symmetric/README.md)              | Symmetric cryptography fundamentals: key generation, block/stream ciphers, padding, AEAD, hash functions, and key derivation. |\n| [**`asymmetric/`**](Python/Basics/asymmetric/README.md)            | Asymmetric cryptography fundamentals: prime generation, RSA operations, digital signatures, and key exchange protocols. |\n\n#### Attacks\n\nThe Attacks section contains practical implementations of cryptographic attack techniques:\n\n| Exercise/Subdirectory   | Description                                                                                   |\n| ----------------------- | --------------------------------------------------------------------------------------------- |\n| **`symmetric/`**        | Attacks on symmetric cryptography: ECB/CBC attacks, padding oracle attacks, keystream reuse, and cipher vulnerabilities. |\n| **`asymmetric/`**       | Attacks on asymmetric cryptography: RSA vulnerabilities, factorization attacks, side-channel analysis, and mathematical cryptanalysis. |\n\n#### CTFs\n\nThe CTF section contains practical challenge scenarios designed to test and improve cryptographic attack skills:\n\n| Exercise/Subdirectory                                               | Description                                                                                                      |\n| ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |\n| [**`symmetric/`**](Python/CTFs/symmetric/README.md)               | CTF challenges focused on symmetric cryptography attacks: padding oracles, mode vulnerabilities, cookie forgery, and implementation flaws. |\n| [**`asymmetric/`**](Python/CTFs/asymmetric/README.md)             | Progressive RSA challenges (Levels 1-9) and public-key cryptosystem attacks, covering factorization, parameter attacks, and advanced cryptanalysis. |\n| [**`hash/`**](Python/CTFs/hash/README.md)                         | Hash function challenges including collision attacks, length extension vulnerabilities, and cryptographic hash analysis. |\n\n## Author\n\n- GitHub: [@eliainnocenti](https://github.com/eliainnocenti)\n- Email: [elia.innocenti@studenti.polito.it](mailto:elia.innocenti@studenti.polito.it)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feliainnocenti%2Fcryptography-exercises","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feliainnocenti%2Fcryptography-exercises","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feliainnocenti%2Fcryptography-exercises/lists"}