| Crates.io | zeppelin_core |
| lib.rs | zeppelin_core |
| version | 0.1.1 |
| created_at | 2023-01-10 19:01:39.712861+00 |
| updated_at | 2023-05-13 15:09:08.134143+00 |
| description | A library that implements a stream cipher based on Balloon hashing |
| homepage | |
| repository | https://github.com/lostinentropy/zeppelin_core |
| max_upload_size | |
| id | 755753 |
| size | 37,903 |
zeppelin_corezeppelin_core is a library that implements a stream cipher based on Balloon hashing.
This project is just for fun. Neither the design nor the implementation of this library have been independently evaluated.
Read and Seek traitsThe architecture is mainly based around hash::Balloon which is a hash
function with variable length output that is then used to implement a
stream cipher. hash::Balloon has three main settings
s_cost which is the size of the internal state in 64 Byte chuckst_cost which is the number of times the internal state will need to
be filled on creation of the cipherstep_delta which is the number of SHA3-512 hashes required to fill
one chunk. This also determines the runtime speed of the stream cipher.Using these parameters one can arbitrarily scale the time and memory requirements of the cipher.
For convenience these are combined into a cipher::CryptSettings object.
For authentication the MAC-then-Encrypt scheme is used.
To make this scheme into an all-or-nothing transform, the salt is also "encrypted" by XOR'ing it with the result of the stream cipher.
The encryption process can be summarized like this:
┌ ─ ─ ─ ─ ─ ┌──────────┐┌────────┐┌────────┐┌────────┐
OS ││ Key ││ File 1 ││ File 2 ││ ... │
└ ─ ─ ─ ─ ─ └──────────┘└────────┘└────────┘└────────┘
│ │ │ │ │
│ │ └─────────┼─────────┘
▼ │ ▼
┌ ─ ─ ─ ─ ─ │ ┏━━━━━━━━━┓
Entropy │ │ ┃ ZIP ┃
└ ─ ─ ─ ─ ─ │ ┗━━━━━━━━━┛
│ │ │
│ │ ┌─────────────┴────┐
▼ │ ▼ ▼
┌──────────┐ │ ┏━━━━━┓ ┌─────┬──────────┐
│ Salt │ ├──▶┃Sha3 ┃──▶│ MAC │Plaintext │
└──────────┘ │ ┗━━━━━┛ ├─────┴──────────┤
│ ▼ └────────────────┘
│ ┏━━━━━━━━━━━┓ ┏━━━┓ │
├────▶┃ Balloon ┃──▶┃Xor┃◀───────┘
│ ┗━━━━━━━━━━━┛ ┗━━━┛
▼ │
┏━━━━━━━━━━━┓ │
┃Wrapped Xor┃◀────────────────┴───────┐
┗━━━━━━━━━━━┛ │
│ ▼
│ ┌──────────┐ ┌──────────────┐
│ │ Metadata │ │MAC/Ciphertext│
│ └──────────┘ └──────────────┘
│ │ │
▼ ▼ ▼
┌──────────┐ ┏━━━━━━━━━━┓ ┌──────────┐
│ Salt │ ┃ json ┃ │ Data │
└──────────┘ ┗━━━━━━━━━━┛ └──────────┘
│ │ │
└───────────────┼───────────────┘
│
▼
┏━━━━━━━━━━┓ ┌──────────┐
┃ ZIP ┃──▶│ _.zep │
┗━━━━━━━━━━┛ └──────────┘
Note: currently only encryption of a single file is implemented.