Skip to content

Commit

Permalink
New commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrizhanovskyi committed Aug 8, 2024
1 parent 96c74d2 commit e298009
Show file tree
Hide file tree
Showing 17 changed files with 804 additions and 4 deletions.
79 changes: 79 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.

Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of actions.

**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).

For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.

[homepage]: https://www.contributor-covenant.org
83 changes: 83 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Contributing to Crypto Comparison Project

Thank you for your interest in contributing to our project! We welcome contributions from the community and aim to make the process as smooth and transparent as possible.

## How to Contribute

### Reporting Issues

If you find any bugs or have suggestions for improvements, please open an issue on GitHub. Provide as much detail as possible, including steps to reproduce the issue and any relevant information.

### Submitting Pull Requests

To contribute code, please follow these steps:

1. **Fork the Repository**

Fork the repository to your own GitHub account.

2. **Clone the Forked Repository**

```sh
git clone https://github.com/dkrizhanovskyi/crypto-comparison.git
cd crypto-comparison
```

3. **Create a New Branch**

Create a new branch for your feature or bug fix.

```sh
git checkout -b feature-name
```

4. **Make Your Changes**

Make your changes in the new branch. Ensure your code follows the project's coding standards.

5. **Commit Your Changes**

Commit your changes with a clear and descriptive commit message.

```sh
git add .
git commit -m "Description of your changes"
```

6. **Push to Your Fork**

Push your changes to your forked repository.

```sh
git push origin feature-name
```

7. **Submit a Pull Request**

Open a pull request from your fork to the main repository. Provide a clear description of your changes and any relevant information.

### Coding Standards

Please adhere to the following coding standards:

- **Python**: Follow PEP 8 guidelines. Use linters such as `flake8` to ensure code quality.
- **Documentation**: Ensure all functions and classes are well-documented. Use docstrings to describe the purpose and usage of your code.

### Testing

Ensure that your code is well-tested. Add unit tests for any new functionality and run all tests to ensure nothing is broken.

```sh
python -m unittest discover
```

### Code of Conduct

By participating in this project, you agree to abide by our [Code of Conduct](CODE_OF_CONDUCT.md). Please treat others with respect and kindness.

## Getting Help

If you have any questions or need help, feel free to open an issue or contact the project maintainers.

Thank you for your contributions!

68 changes: 68 additions & 0 deletions DETAILED_ALGORITHMS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Detailed Descriptions of Cryptographic Algorithms

This document provides detailed descriptions of various cryptographic algorithms used in classical and quantum cryptography. Each algorithm is explained with its principles, security aspects, and example implementations.

## Classical Cryptographic Algorithms

### RSA (Rivest-Shamir-Adleman)

RSA is an asymmetric cryptographic algorithm based on the mathematical difficulty of factoring large integers.

- **Principles**: Uses a pair of keys, public and private, for encryption and decryption. Security relies on the difficulty of factoring the product of two large prime numbers.
- **Security**: Secure with key sizes of 2048 bits or more. Vulnerable to quantum attacks.
- **Example Implementation**: See `classical_cryptography/algorithms/rsa_example.py`.

### AES (Advanced Encryption Standard)

AES is a symmetric encryption algorithm widely used for securing data.

- **Principles**: Uses the same key for both encryption and decryption. Operates on fixed block sizes of 128 bits with key sizes of 128, 192, or 256 bits.
- **Security**: Considered secure when using sufficient key lengths (128 bits or more). Resistant to known cryptographic attacks.
- **Example Implementation**: See `classical_cryptography/algorithms/aes_example.py`.

### ECC (Elliptic Curve Cryptography)

ECC is an asymmetric cryptographic algorithm based on the algebraic structure of elliptic curves over finite fields.

- **Principles**: Uses elliptic curves to generate public and private keys. Provides strong security with smaller key sizes compared to RSA.
- **Security**: Secure against classical attacks and provides strong security with smaller key sizes (e.g., 256-bit ECC key is comparable to a 3072-bit RSA key). Vulnerable to quantum attacks.
- **Example Implementation**: See `classical_cryptography/algorithms/ecc_example.py`.

## Quantum Cryptographic Protocols

### Quantum Key Distribution (QKD)

QKD uses principles of quantum mechanics to securely distribute cryptographic keys.

- **Principles**: Relies on quantum states and the Heisenberg Uncertainty Principle to detect eavesdropping. The most common protocol is BB84.
- **Security**: Provides unconditional security based on the laws of quantum mechanics. Immune to quantum attacks.
- **Example Implementation**: See `quantum_cryptography/protocols/qkd_example.py`.

### BB84 Protocol

BB84 is a QKD protocol that uses photon polarization states to encode and distribute keys.

- **Principles**: Uses random bases for encoding and measuring photon states. Key sifting is performed to generate a secure shared key.
- **Security**: Provides security against eavesdropping based on quantum mechanics.
- **Example Implementation**: See `quantum_cryptography/protocols/bb84_example.py`.

### Grover's Algorithm

Grover's algorithm is a quantum algorithm that provides a quadratic speedup for unstructured search problems.

- **Principles**: Uses quantum superposition and interference to search an unsorted database in \(O(\sqrt{N})\) time.
- **Security**: Demonstrates the power of quantum computing in solving specific problems faster than classical algorithms.
- **Example Implementation**: See `quantum_cryptography/protocols/grover_example.py`.

### Quantum Teleportation

Quantum teleportation is a protocol for transferring quantum states between distant locations using entanglement.

- **Principles**: Uses entangled particles and classical communication to transfer quantum information.
- **Security**: Demonstrates fundamental quantum principles and can be used in quantum communication.
- **Example Implementation**: See `quantum_cryptography/protocols/quantum_teleportation_example.py`.

## References

- For more detailed information on cryptographic algorithms, see resources such as [SpringerLink](https://link.springer.com/), [arXiv](https://arxiv.org/), and [IEEE Xplore](https://ieeexplore.ieee.org/).
- Additional details on quantum cryptography can be found on [Quantum Cryptography Wikipedia](https://en.wikipedia.org/wiki/Quantum_cryptography).
80 changes: 80 additions & 0 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Installation Guide

This document provides step-by-step instructions for setting up the environment and installing the dependencies required to run the examples and tests in the Crypto Comparison Project.

## Prerequisites

Ensure that you have the following software installed on your system:

- Python 3.7 or higher
- Git

## Cloning the Repository

First, clone the repository to your local machine:

```sh
git clone https://github.com/dkrizhanovskyi/crypto-comparison.git
cd crypto-comparison
```

## Setting Up a Virtual Environment

It's recommended to create a virtual environment to manage dependencies. Run the following commands to create and activate a virtual environment:

```sh
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
```

## Installing Dependencies

Install the required Python packages using `pip`:

```sh
pip install -r requirements.txt
```

The `requirements.txt` file should include the following packages:

```txt
qiskit
pycryptodome
```

## Running Examples

To run the example scripts, navigate to the corresponding directory and execute the script:

```sh
python classical_cryptography/algorithms/rsa_example.py
python classical_cryptography/algorithms/aes_example.py
python classical_cryptography/algorithms/ecc_example.py
python quantum_cryptography/protocols/qkd_example.py
python quantum_cryptography/protocols/bb84_example.py
python quantum_cryptography/protocols/grover_example.py
python quantum_cryptography/protocols/quantum_teleportation_example.py
python quantum_cryptography/protocols/quantum_encryption_example.py
python quantum_cryptography/protocols/quantum_superposition_entanglement_example.py
```

## Running Tests

To run the tests, use the following command:

```sh
python -m unittest discover
```

This command will discover and run all test cases in the repository.

## Additional Resources

- [Qiskit Documentation](https://qiskit.org/documentation/)
- [PyCryptodome Documentation](https://www.pycryptodome.org/src/installation)

If you encounter any issues during installation or setup, please open an issue on GitHub.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for details.
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,42 @@

# Comparison of Classical and Quantum Cryptography

This project aims to compare classical and quantum cryptography. We will examine the basic principles, algorithms, protocols, security, and applications of these technologies.

## Project Structure

- `classical_cryptography/`: Materials on classical cryptography.
- `overview.md`: General overview of classical cryptography.
- `algorithms/`: Detailed descriptions and examples of classical cryptographic algorithms.
- `rsa.md`: Detailed description of RSA algorithm.
- `rsa_example.py`: Example code for RSA algorithm.
- `test_rsa_example.py`: Tests for RSA example code.
- `aes.md`: Detailed description of AES algorithm.
- `aes_example.py`: Example code for AES algorithm.
- `test_aes_example.py`: Tests for AES example code.
- `ecc.md`: Detailed description of ECC algorithm.
- `ecc_example.py`: Example code for ECC algorithm.
- `test_ecc_example.py`: Tests for ECC example code.
- `quantum_cryptography/`: Materials on quantum cryptography.
- `overview.md`: General overview of quantum cryptography.
- `protocols/`: Detailed descriptions and examples of quantum cryptographic protocols.
- `qkd.md`: Detailed description of QKD protocol.
- `qkd_example.py`: Example code for QKD protocol.
- `test_qkd_example.py`: Tests for QKD example code.
- `bb84_example.py`: Example code for BB84 protocol.
- `test_bb84_example.py`: Tests for BB84 example code.
- `ecc_qkd_example.py`: Example code for ECC in QKD.
- `test_ecc_qkd_example.py`: Tests for ECC in QKD example code.
- `grover_example.py`: Example code for Grover's algorithm.
- `test_grover_example.py`: Tests for Grover's algorithm example code.
- `quantum_teleportation_example.py`: Example code for quantum teleportation.
- `test_quantum_teleportation_example.py`: Tests for quantum teleportation example code.
- `bb84_qiskit_example.py`: Example code for BB84 on Qiskit.
- `test_bb84_qiskit_example.py`: Tests for BB84 on Qiskit example code.
- `quantum_encryption_example.py`: Example code for quantum encryption.
- `test_quantum_encryption_example.py`: Tests for quantum encryption example code.
- `quantum_superposition_entanglement_example.py`: Example code for quantum superposition and entanglement.
- `test_quantum_superposition_entanglement_example.py`: Tests for quantum superposition and entanglement example code.
- `comparison.md`: Comparison of classical and quantum cryptography.

## Goals
Expand All @@ -23,10 +54,6 @@ git clone https://github.com/dkrizhanovskyi/crypto-comparison.git
cd crypto-comparison
```

## Contributing

We welcome contributions! Please read our [contributing guidelines](CONTRIBUTING.md) before making any changes.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
Loading

0 comments on commit e298009

Please sign in to comment.