{"id":24018742,"url":"https://github.com/iboud0/rsa-encryption-and-in-practice","last_synced_at":"2025-07-31T01:13:32.738Z","repository":{"id":268279313,"uuid":"903774472","full_name":"iboud0/RSA-Encryption-and-In-Practice","owner":"iboud0","description":"Implementation and exploration of RSA encryption, including its security properties, practical applications, and real-world use cases. A class project to learn and experiment with cryptographic principles","archived":false,"fork":false,"pushed_at":"2025-01-05T21:59:18.000Z","size":1,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-05T22:27:26.133Z","etag":null,"topics":["cryptographic-algorithms","cryptography","cryptography-project","encryption","python","rsa","secure-communication","security"],"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/iboud0.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}},"created_at":"2024-12-15T14:31:36.000Z","updated_at":"2025-01-05T21:59:21.000Z","dependencies_parsed_at":"2024-12-15T19:18:50.275Z","dependency_job_id":"97b3c6b5-a80f-48cc-b92c-21e217bc7117","html_url":"https://github.com/iboud0/RSA-Encryption-and-In-Practice","commit_stats":null,"previous_names":["iboud0/rsa-encryption-and-in-practice"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboud0%2FRSA-Encryption-and-In-Practice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboud0%2FRSA-Encryption-and-In-Practice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboud0%2FRSA-Encryption-and-In-Practice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboud0%2FRSA-Encryption-and-In-Practice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iboud0","download_url":"https://codeload.github.com/iboud0/RSA-Encryption-and-In-Practice/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240749562,"owners_count":19851498,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cryptographic-algorithms","cryptography","cryptography-project","encryption","python","rsa","secure-communication","security"],"created_at":"2025-01-08T10:18:43.160Z","updated_at":"2025-02-25T21:28:38.185Z","avatar_url":"https://github.com/iboud0.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RSA Cryptographic System\n\n## Introduction\n\nThis project demonstrates the implementation of an **RSA Cryptographic System** in Python. RSA is a widely used public-key cryptographic algorithm that ensures secure data transmission. The project includes functions for generating keys, encrypting and decrypting messages, and signing and verifying messages.\n\n## Project Structure\n\n- **`rsa/`**\n  - **`__init__.py`**: Initializes the module and imports key functions.\n  - **`key_generation.py`**: Contains functions for generating public and private key pairs.\n  - **`encryption.py`**: Includes functions for encryption and decryption of messages.\n  - **`signing.py`**: Provides functionality for signing messages and verifying signatures.\n  - **`utilities.py`**: Contains helper functions like `generate_prime` and `mod_inverse`.\n- **`main.py`**: Entry point for testing the RSA system with key generation, encryption, signing, and verification.\n- **`requirements.txt`**: Contains requirements needed to run the project.\n- **`README.md`**: Documentation file (this file).\n\n## How to Run\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/iboud0/RSA-Encryption-and-In-Practice.git\n   cd RSA-Encryption-and-In-Practice\n   ```\n\n2. Install the required dependencies:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n3. Run the program:\n   ```bash\n   python main.py\n   ```\n\n## Key Functions\n\n### `generate_keypair(bits=1024)`\nGenerates a public and private RSA key pair.\n- **Parameters:** `bits` - The number of bits for the key size (default is 1024)\n- **Returns:** Tuple containing (public_key, private_key)\n\n### `encrypt(message, public_key)`\nEncrypts a message using the RSA public key.\n- **Parameters:**\n  - `message` - The message to encrypt\n  - `public_key` - The public key used for encryption\n- **Returns:** Encrypted message (ciphertext)\n\n### `decrypt(cipher, private_key)`\nDecrypts a ciphertext using the RSA private key.\n- **Parameters:**\n  - `cipher` - The encrypted message\n  - `private_key` - The private key used for decryption\n- **Returns:** Decrypted message (plaintext)\n\n### `sign(message, private_key)`\nSigns a message using the RSA private key.\n- **Parameters:**\n  - `message` - The message to sign\n  - `private_key` - The private key used for signing\n- **Returns:** Message signature\n\n### `verify(message, signature, public_key)`\nVerifies the authenticity of a message's signature.\n- **Parameters:**\n  - `message` - The original message\n  - `signature` - The signature to verify\n  - `public_key` - The public key used for verification\n- **Returns:** Boolean (True if signature is valid)\n\n## Helper Functions\n\n### `generate_prime(bits=1024)`\nGenerates a random prime number.\n- **Parameters:** `bits` - The number of bits for the prime number (default is 1024)\n- **Returns:** A prime number in the range [2^(bits-1), 2^bits]\n- **Location:** `utilities.py`\n\n### `mod_inverse(e, phi)`\nCalculates the modular multiplicative inverse using Extended Euclidean Algorithm.\n- **Parameters:**\n  - `e` - The number to find inverse for\n  - `phi` - The modulus\n- **Returns:** Modular multiplicative inverse of e modulo phi\n- **Location:** `utilities.py`\n\n## Program Variables\n\nThe main program (`main.py`) uses the following key variables:\n- `public_key`: Generated RSA public key\n- `private_key`: Generated RSA private key\n- `message`: Plaintext message for encryption/signing\n- `cipher`: Encrypted message\n- `decrypted`: Decrypted message\n- `signature`: Message signature\n- `is_verified`: Signature verification result\n\n## Requirements\n\nRequired Python packages:\n- sympy\n- hashlib\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiboud0%2Frsa-encryption-and-in-practice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiboud0%2Frsa-encryption-and-in-practice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiboud0%2Frsa-encryption-and-in-practice/lists"}