Crates.io | crypto-permutation |
lib.rs | crypto-permutation |
version | 0.1.0 |
source | src |
created_at | 2023-07-10 08:56:12.759842 |
updated_at | 2023-07-10 08:56:12.759842 |
description | Permutation based cryptography framework; core traits |
homepage | |
repository | https://github.com/niluxv/permutation_based_crypto |
max_upload_size | |
id | 912736 |
size | 35,800 |
Abstractions for permutation based cryptography in Rust.
This crate provides abstractions for generic permutation based cryptography. This allows other crates to build constructions generic over the concrete cryptographic permutation or a deck-function. The API can be considered to consist of three main parts:
The cryptographic IO abstractions are foundational for this entire crate. The other abstractions build on top of it.
The cryptographic IO abstractions give generic ways to input data into cryptographic functions (like hash or dec/deck functions) or get output from cryptographic functions (like stream ciphers, extendable output functions or dec/deck functions). The same traits can also be used to abstract over (fixed or variable sized) buffers, which is for example useful for abstracting over low-level primitives like permutations.
The API consists of two core traits:
Writer
: A buffer or construction data can be written to. This is used for example for inputting data into a deck function.
Reader
: A buffer that can be read from or a construction that can generate an output stream. This is used for example for generating an output stream from a deck function.
Cryptographic permutations are abstracted over using two traits:
PermutationState
: A fixed size buffer cryptographic permutations can act on. It can have specific data layout (e.g. byteorder) requirements, as long as it is possible to clone states, xor states together and xor and write bytes into (using the Writer
trait) and read bytes from (using the Reader
trait).
Permutation
: A cryptographic permutation. It acts on a specific PermutationState
.
A deck function is a Doubly Extendable Cryptographic Keyed function. It is abstracted over by the DeckFunction
trait. It allows repeatedly inputting and outputting variable length streams of data. For inputting data, the Writer
trait is used, and for outputting the Reader
trait is used.