# Ferric Crypto Lib
This is a collection of cryptographic algorithms implemented in Rust for use during the crypto courses I attend.
The structure of the project might change in the future, but for now it is a single crate with all the algorithms implemented as functions. In the future I might make structs for each algorithm and implement the `Encrypt` and `Decrypt` traits for them.
## Implemented Algorithms
- [ ] Affine Hill (Custom algorithm)
- [ ] Bernel-Fibonaccis (Custom algorithm)
- [ ] Bifid Chiffre
- [x] Ceasar
- [ ] DES
- [ ] Dubbel Sick-Sack (Custom algorithm)
- [ ] Enigma
- [ ] Kid-RSA (Custom algorithm)
- [ ] Minigma (Custom algorithm)
- [x] Hill (no decrypt yet, but simple to do by hand to get a new key)
- [x] Monoalphabetic
- [ ] MIX (Custom algorithm)
- [ ] Sick-Sack (Custom algorithm)
- [x] Transposition (no decrypt yet)
- [ ] TrissDES (Custom algorithm)
- [ ] Vernam
- [ ] Vernam (LKG28)
- [ ] Vigenere
- [ ] Vokkon (Custom algorithm)
## Usage
### Add to your project
Add the following to your `Cargo.toml`:
#### From Gitlab
```toml
[dependencies]
ferric_crypto_lib = { git = "https://gitlab.com/ferric1/ferric_crypto.git" }
```
#### From Path
```toml
[dependencies]
ferric_crypto_lib = { path = "/path/to/ferric_crypto" }
```
### Use in your code
All algorithms are implemented as functions in the `ferric_crypto_lib` crate. To use them, simply import the crate and call the function you want to use. All encryption functions are withing the `encrypt` module and all decryption functions are within the `decrypt` module.
#### Example
***TODO: fix example***
```rust
use ferric_crypto_lib::encrypt::ceasar::*;
use ferric_crypto_lib::decrypt::ceasar::*;
fn main() {
let encrypted = encrypt("Hello World");
let decrypted = decrypt(&encrypted);
println!("Encrypted: {}", encrypted);
println!("Decrypted: {}", decrypted);
}
```
## Building
### Prerequisites
You will need some tools to build the library, click the links to go to the instructions for installing them:
* [Rust](#Rust)
* [Git](#Git)
* [Just](#Just) (The build system used)
* [Maturin](#Maturin) (for building the python module)
After installing the prerequisites, follow these steps to build:
### 1. Clone the repository
#### Using HTTPS
```bash
git clone https://gitlab.com/ferric1/ferric_crypto.git
```
#### Using SSH
```bash
git clone git@gitlab.com:ferric1/ferric_crypto.git
```
### 2. Test the library
***This is optional, but recommended***
```bash
just test
```
### 3. Build the library
#### Build for Rust
```bash
just build
```
#### Build for Python
*Here you need [Maturin](#Maturin) in order to build*
```bash
just build-py
```
### 4. Install the library
If you intend to use the library in a python project, you need to install it. This is done with the following command:
```bash
just install-py
```
This will force install it to your python environment, this is so we dont need to remove it before installing a new version during development.
## Development
### Adding Crypto Algorithms
To add a new algorithm, simply run this command:
```bash
just add-algo <name>
```
This will create a new file in the [`src`](src) folder with the name `<name>.rs` and add the following code to it:
```rust
use crate::error::CharacterParseError;
use crate::Traits::{Encrypt, Decrypt};
/// Enum representing possible errors in the name cipher.
#[derive(Debug, PartialEq)]
pub enum nameError {
CharacterParseError(CharacterParseError),
// Define error variants here
}
/// Represents a name cipher.
#[cfg_attr(feature = "python-integration", pyclass)]
pub struct name {
// Define struct fields here
}
impl name {
// Define methods here
fn new() -> Self {
Self {
// Define struct fields here
}
}
}
#[cfg(feature = "python-integration")]
mod python_integration {
use super::*;
use pyo3::prelude::*;
use pyo3::{pyclass, PyResult, pymethods};
#[pymethods]
impl name {
// Define Python integration methods here
}
}
```
Where we replace `name` with the name of the new algorithm. This will also add the new algorithm to the [`mod.rs`](src/crypto_systems/mod.rs) file inside the [`src/crypto_systems`](src/crypto_systems/mod.rs) folder. We also make new standard files for the `Encrypt`, `Decrypt` and `BruteForce` traits in their respective modules, this is where the implementations of the algorithm will go.
You will also need to add the new algorithm to the [`lib.rs`](src/lib.rs) file where we define our python module.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
## Owner
* **Emil Schutt** - [Tosic.Killer](https://gitlab.com/retrokiller543)
Raw data
{
"_id": null,
"home_page": "https://gitlab.com/ferric1/ferric_crypto",
"name": "ferric-crypto-lib",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "ferric,crypto,rust,cryptography,brute-force",
"author": "Tosic.Killer <emil.schutt@gmail.com>",
"author_email": "Tosic.Killer <emil.schutt@gmail.com>",
"download_url": "",
"platform": null,
"description": "# Ferric Crypto Lib\n\nThis is a collection of cryptographic algorithms implemented in Rust for use during the crypto courses I attend.\n\nThe structure of the project might change in the future, but for now it is a single crate with all the algorithms implemented as functions. In the future I might make structs for each algorithm and implement the `Encrypt` and `Decrypt` traits for them.\n\n\n## Implemented Algorithms\n\n- [ ] Affine Hill (Custom algorithm)\n- [ ] Bernel-Fibonaccis (Custom algorithm)\n- [ ] Bifid Chiffre\n- [x] Ceasar\n- [ ] DES\n- [ ] Dubbel Sick-Sack (Custom algorithm)\n- [ ] Enigma\n- [ ] Kid-RSA (Custom algorithm)\n- [ ] Minigma (Custom algorithm)\n- [x] Hill (no decrypt yet, but simple to do by hand to get a new key)\n- [x] Monoalphabetic\n- [ ] MIX (Custom algorithm)\n- [ ] Sick-Sack (Custom algorithm)\n- [x] Transposition (no decrypt yet)\n- [ ] TrissDES (Custom algorithm)\n- [ ] Vernam\n- [ ] Vernam (LKG28)\n- [ ] Vigenere\n- [ ] Vokkon (Custom algorithm)\n\n## Usage\n\n### Add to your project\n\nAdd the following to your `Cargo.toml`:\n\n#### From Gitlab\n\n```toml\n[dependencies]\nferric_crypto_lib = { git = \"https://gitlab.com/ferric1/ferric_crypto.git\" }\n```\n\n#### From Path\n \n```toml\n[dependencies]\nferric_crypto_lib = { path = \"/path/to/ferric_crypto\" }\n```\n\n\n### Use in your code\n\nAll algorithms are implemented as functions in the `ferric_crypto_lib` crate. To use them, simply import the crate and call the function you want to use. All encryption functions are withing the `encrypt` module and all decryption functions are within the `decrypt` module.\n\n\n#### Example\n***TODO: fix example***\n```rust\nuse ferric_crypto_lib::encrypt::ceasar::*;\nuse ferric_crypto_lib::decrypt::ceasar::*;\n\nfn main() {\n let encrypted = encrypt(\"Hello World\");\n let decrypted = decrypt(&encrypted);\n println!(\"Encrypted: {}\", encrypted);\n println!(\"Decrypted: {}\", decrypted);\n}\n```\n\n## Building \n\n### Prerequisites\n\nYou will need some tools to build the library, click the links to go to the instructions for installing them:\n\n* [Rust](#Rust)\n* [Git](#Git)\n* [Just](#Just) (The build system used)\n* [Maturin](#Maturin) (for building the python module) \n\nAfter installing the prerequisites, follow these steps to build:\n\n### 1. Clone the repository\n \n#### Using HTTPS \n ```bash\n git clone https://gitlab.com/ferric1/ferric_crypto.git\n ```\n\n#### Using SSH\n ```bash\n git clone git@gitlab.com:ferric1/ferric_crypto.git\n ```\n\n### 2. Test the library\n\n***This is optional, but recommended***\n\n```bash\njust test\n```\n\n### 3. Build the library\n\n#### Build for Rust\n\n```bash\njust build\n```\n\n#### Build for Python\n\n*Here you need [Maturin](#Maturin) in order to build*\n\n```bash\njust build-py\n```\n\n### 4. Install the library\n\nIf you intend to use the library in a python project, you need to install it. This is done with the following command:\n\n```bash\njust install-py\n```\n\nThis will force install it to your python environment, this is so we dont need to remove it before installing a new version during development.\n\n## Development\n\n### Adding Crypto Algorithms\n\nTo add a new algorithm, simply run this command:\n\n```bash\njust add-algo <name>\n```\n\nThis will create a new file in the [`src`](src) folder with the name `<name>.rs` and add the following code to it:\n\n```rust\nuse crate::error::CharacterParseError;\nuse crate::Traits::{Encrypt, Decrypt};\n\n/// Enum representing possible errors in the name cipher.\n#[derive(Debug, PartialEq)]\npub enum nameError {\n CharacterParseError(CharacterParseError),\n // Define error variants here\n}\n\n/// Represents a name cipher.\n#[cfg_attr(feature = \"python-integration\", pyclass)]\npub struct name {\n // Define struct fields here\n}\n\nimpl name {\n // Define methods here\n fn new() -> Self {\n Self {\n // Define struct fields here\n }\n }\n}\n\n#[cfg(feature = \"python-integration\")]\nmod python_integration {\n use super::*;\n use pyo3::prelude::*;\n use pyo3::{pyclass, PyResult, pymethods};\n\n #[pymethods]\n impl name {\n // Define Python integration methods here\n }\n}\n```\n\nWhere we replace `name` with the name of the new algorithm. This will also add the new algorithm to the [`mod.rs`](src/crypto_systems/mod.rs) file inside the [`src/crypto_systems`](src/crypto_systems/mod.rs) folder. We also make new standard files for the `Encrypt`, `Decrypt` and `BruteForce` traits in their respective modules, this is where the implementations of the algorithm will go.\n\nYou will also need to add the new algorithm to the [`lib.rs`](src/lib.rs) file where we define our python module.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n\n## Owner\n\n* **Emil Schutt** - [Tosic.Killer](https://gitlab.com/retrokiller543)\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A library for Ferric Crypto",
"version": "0.2.6",
"project_urls": {
"Homepage": "https://gitlab.com/ferric1/ferric_crypto",
"Source Code": "https://gitlab.com/ferric1/ferric_crypto"
},
"split_keywords": [
"ferric",
"crypto",
"rust",
"cryptography",
"brute-force"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7ea76035a126c0ac4a7aa539f0d9fffe589cecaad3858737d78d77a440e360df",
"md5": "96df093d808e9ac9d6d6f7fd0bdd7191",
"sha256": "e63d3698e40d34d996c58a8e0fedc0bad70736ad359fcfea0e28aa665e6714fc"
},
"downloads": -1,
"filename": "ferric_crypto_lib-0.2.6-cp310-cp310-manylinux_2_34_x86_64.whl",
"has_sig": false,
"md5_digest": "96df093d808e9ac9d6d6f7fd0bdd7191",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.7",
"size": 1437293,
"upload_time": "2023-12-26T14:58:08",
"upload_time_iso_8601": "2023-12-26T14:58:08.948848Z",
"url": "https://files.pythonhosted.org/packages/7e/a7/6035a126c0ac4a7aa539f0d9fffe589cecaad3858737d78d77a440e360df/ferric_crypto_lib-0.2.6-cp310-cp310-manylinux_2_34_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "535989565a8e6bb014921d5a2db868430fd3f69e38f2e0536f814c948e27bf08",
"md5": "9c21b56029ae4f3bca51e9f0f6b054fa",
"sha256": "6458fb91adbd2bf49a837f734d5f490d131c0e1d5a33f53d277f31038facedfa"
},
"downloads": -1,
"filename": "ferric_crypto_lib-0.2.6-cp311-cp311-manylinux_2_34_x86_64.whl",
"has_sig": false,
"md5_digest": "9c21b56029ae4f3bca51e9f0f6b054fa",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.7",
"size": 1437660,
"upload_time": "2023-12-26T14:58:12",
"upload_time_iso_8601": "2023-12-26T14:58:12.583848Z",
"url": "https://files.pythonhosted.org/packages/53/59/89565a8e6bb014921d5a2db868430fd3f69e38f2e0536f814c948e27bf08/ferric_crypto_lib-0.2.6-cp311-cp311-manylinux_2_34_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3fb07f3f5a6aa6235d01a5a3e9f0735b276447945498b044af7c7d1dd92f9ca4",
"md5": "edd6bdaba6d048c7dd5b4a0623da83a5",
"sha256": "5166872f05dee5ac867b5bc35a3219d6f822b9c55df5bab0badbdca0966507b1"
},
"downloads": -1,
"filename": "ferric_crypto_lib-0.2.6-cp37-cp37m-manylinux_2_34_x86_64.whl",
"has_sig": false,
"md5_digest": "edd6bdaba6d048c7dd5b4a0623da83a5",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": ">=3.7",
"size": 1437493,
"upload_time": "2023-12-26T14:58:15",
"upload_time_iso_8601": "2023-12-26T14:58:15.846448Z",
"url": "https://files.pythonhosted.org/packages/3f/b0/7f3f5a6aa6235d01a5a3e9f0735b276447945498b044af7c7d1dd92f9ca4/ferric_crypto_lib-0.2.6-cp37-cp37m-manylinux_2_34_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "195d5edd4fab75b4b079665a49f7e8e7f1cc5e7662916f595388a253b0555f6b",
"md5": "cbdec584d5dc32c6be18553c34833468",
"sha256": "a8612c51873871182c46b63bb8c8d4d97ed332ead45284128641320a11d3c439"
},
"downloads": -1,
"filename": "ferric_crypto_lib-0.2.6-cp38-cp38-manylinux_2_34_x86_64.whl",
"has_sig": false,
"md5_digest": "cbdec584d5dc32c6be18553c34833468",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.7",
"size": 1437155,
"upload_time": "2023-12-26T14:58:18",
"upload_time_iso_8601": "2023-12-26T14:58:18.189078Z",
"url": "https://files.pythonhosted.org/packages/19/5d/5edd4fab75b4b079665a49f7e8e7f1cc5e7662916f595388a253b0555f6b/ferric_crypto_lib-0.2.6-cp38-cp38-manylinux_2_34_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b19a6bbab43f8b59e69e2d3f986dd4620b75b4a80e7f3cda907cd3d511239067",
"md5": "5493bfe9136f3d382c60782def8f0ede",
"sha256": "e8b13c7f665225a2489ea5443e1a2bcce3b37852f468a989d7fe1f5e13804a0f"
},
"downloads": -1,
"filename": "ferric_crypto_lib-0.2.6-cp39-cp39-manylinux_2_34_x86_64.whl",
"has_sig": false,
"md5_digest": "5493bfe9136f3d382c60782def8f0ede",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.7",
"size": 1437486,
"upload_time": "2023-12-26T14:58:20",
"upload_time_iso_8601": "2023-12-26T14:58:20.724545Z",
"url": "https://files.pythonhosted.org/packages/b1/9a/6bbab43f8b59e69e2d3f986dd4620b75b4a80e7f3cda907cd3d511239067/ferric_crypto_lib-0.2.6-cp39-cp39-manylinux_2_34_x86_64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-26 14:58:08",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "ferric1",
"gitlab_project": "ferric_crypto",
"lcname": "ferric-crypto-lib"
}