Expand description
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:
- Cryptographic IO abstractions
- Cryptographic permutation abstraction
- Deck function abstraction
The cryptographic IO abstractions are foundational for this entire crate. The other abstractions build on top of it.
§IO
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.
§Permutations
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 theWriter
trait) and read bytes from (using theReader
trait).Permutation
: A cryptographic permutation. It acts on a specificPermutationState
.
§Deck functions
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.
Re-exports§
pub use buffer::BufMut;
pub use io::CryptoReader;
pub use io::Reader;
pub use io::WriteTooLargeError;
pub use io::Writer;
Modules§
- buffer
- Potentially uninitialised buffers that guarantee that they are not deinitialised again after init.
- io
- Reader and writer traits to generalise over writing to and reading from buffers in memory and cryptographic constructions which take variable length input or generate variable length output.
Traits§
- Deck
Function - A doubly-ended cryptographic keyed function.
- Permutation
- A cryptographic permutation.
- Permutation
State - A state where a cryptographic permutation acts upon.