#permutation #cryptography #crypto #crytography

no-std crypto-permutation

Permutation based cryptography framework; core traits

1 unstable release

0.1.0 Jul 10, 2023

#282 in No standard library


Used in 3 crates

MIT/Apache

36KB
426 lines

crypto-permutation License: MIT OR Apache-2.0 crypto-permutation on crates.io crypto-permutation on docs.rs Source Code Repository Rust Version: ^1.65

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:

  1. Cryptographic IO abstractions
  2. Cryptographic permutation abstraction
  3. 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 the Writer trait) and read bytes from (using the Reader trait).
  • Permutation: A cryptographic permutation. It acts on a specific PermutationState.

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.

No runtime deps

Features