Package: ferric-crypto-lib
Ferric Crypto LibThis 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 theEncryptandDecrypttraits for them.Implemented AlgorithmsAffine Hill (Custom algorithm)Bernel-Fibonaccis (Custom algorithm)Bifid ChiffreCeasarDESDubbel Sick-Sack (Custom algorithm)EnigmaKid-RSA (Custom algorithm)Minigma (Custom algorithm)Hill (no decrypt yet, but simple to do by hand to get a new key)MonoalphabeticMIX (Custom algorithm)Sick-Sack (Custom algorithm)Transposition (no decrypt yet)TrissDES (Custom algorithm)VernamVernam (LKG28)VigenereVokkon (Custom algorithm)UsageAdd to your projectAdd the following to yourCargo.toml:From Gitlab[dependencies]ferric_crypto_lib={git="https://gitlab.com/ferric1/ferric_crypto.git"}From Path[dependencies]ferric_crypto_lib={path="/path/to/ferric_crypto"}Use in your codeAll algorithms are implemented as functions in theferric_crypto_libcrate. To use them, simply import the crate and call the function you want to use. All encryption functions are withing theencryptmodule and all decryption functions are within thedecryptmodule.ExampleTODO: fix exampleuseferric_crypto_lib::encrypt::ceasar::*;useferric_crypto_lib::decrypt::ceasar::*;fnmain(){letencrypted=encrypt("Hello World");letdecrypted=decrypt(&encrypted);println!("Encrypted: {}",encrypted);println!("Decrypted: {}",decrypted);}BuildingPrerequisitesYou will need some tools to build the library, click the links to go to the instructions for installing them:RustGitJust(The build system used)Maturin(for building the python module)After installing the prerequisites, follow these steps to build:1. Clone the repositoryUsing 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 libraryThis is optional, but recommendedjusttest3. Build the libraryBuild for RustjustbuildBuild for PythonHere you needMaturinin order to buildjustbuild-py4. Install the libraryIf you intend to use the library in a python project, you need to install it. This is done with the following command:justinstall-pyThis will force install it to your python environment, this is so we dont need to remove it before installing a new version during development.DevelopmentAdding Crypto AlgorithmsTo add a new algorithm, simply run this command:justadd-algo<name>This will create a new file in thesrcfolder with the name<name>.rsand add the following code to it:usecrate::error::CharacterParseError;usecrate::Traits::{Encrypt,Decrypt};/// Enum representing possible errors in the name cipher.#[derive(Debug, PartialEq)]pubenumnameError{CharacterParseError(CharacterParseError),// Define error variants here}/// Represents a name cipher.#[cfg_attr(feature ="python-integration", pyclass)]pubstructname{// Define struct fields here}implname{// Define methods herefnnew()->Self{Self{// Define struct fields here}}}#[cfg(feature ="python-integration")]modpython_integration{usesuper::*;usepyo3::prelude::*;usepyo3::{pyclass,PyResult,pymethods};#[pymethods]implname{// Define Python integration methods here}}Where we replacenamewith the name of the new algorithm. This will also add the new algorithm to themod.rsfile inside thesrc/crypto_systemsfolder. We also make new standard files for theEncrypt,DecryptandBruteForcetraits in their respective modules, this is where the implementations of the algorithm will go.You will also need to add the new algorithm to thelib.rsfile where we define our python module.LicenseThis project is licensed under the MIT License - see theLICENSEfile for detailsOwnerEmil Schutt-Tosic.Killer