tequel-rs 0.5.7

A high-performance, chaotic AEAD encryption engine built on the TQL-11 ARX primitive.
Documentation
# Tequel


![Crates.io Version](https://img.shields.io/crates/v/tequel-rs?style=flat-square&color=orange)
![License](https://img.shields.io/badge/license-MIT-blue?style=flat-square)
![Rust](https://img.shields.io/badge/rust-v1.70%2B-black?style=flat-square&logo=rust)

*A high-performance authenticated symmetric encryption engine (AEAD) and KDF, robust and chaotic, built in pure Rust.*

**Tequel 0.5.7 High-Performance AEAD:** Certified Entropy of 7.999986 and Avalanche Stability over 110M iterations. Designed for secure local storage, high-speed obfuscation, and cryptographic research.

*By Gabriel Xavier (@dotxav)*

## Summary


- [Tequel]#tequel
  - [Summary]#summary
  - [πŸ”¬ Internal Architecture: TQL-11]#-internal-architecture-tql-11
  - [πŸ“Š Performance Benchmarks]#-performance-benchmarks
  - [πŸ›‘οΈ Stress and Safety Report (v0.5.7)]#️-stress-and-safety-report-v057
    - [**1. Avalanche Effect (SAC)**]#1-avalanche-effect-sac
    - [**2. Shannon Entropy Analysis**]#2-shannon-entropy-analysis
    - [**3. Memory Forensic Resistance**]#3-memory-forensic-resistance
  - [βš™οΈ Core Features]#️-core-features
  - [πŸ“₯ Installation \& Usage](#-installation--usage)
  - [Basic Hashing]#basic-hashing
  - [πŸ”‘ Key Derivation (KDF)]#-key-derivation-kdf
  - [Why the name 'Tequel'?]#why-the-name-tequel
  - [License]#license

## πŸ”¬ Internal Architecture: TQL-11


Tequel is powered by the **TQL-11**, a custom ARX-based (Addition-Rotation-XOR) cryptographic primitive. 

* **Mathematically Grounded:** Internal state initialized with constants derived from $\pi$, $e$, and the Golden Ratio ($\phi$).
* **Maximum Diffusion:** 12-register state chain with a non-linear feedback loop and dynamic bit-mixing.
* **Security First:** Zero-cost memory safety via the `Zeroize` protocol to prevent data leakage.

πŸ‘‰ [Read the Full White Paper](./WHITE_PAPER.md) for detailed mathematical specifications.

## πŸ“Š Performance Benchmarks


Verified using `criterion.rs` on an optimized release build.

| Operation | Data Size | Result |
| :--- | :--- | :--- |
| **Hashing Latency** | 1 KB | **105.5 Β΅s** |
| **Stable Throughput** | 1 MB | **9.31 MiB/s** |
| **KDF (1000 iter)** | Password | **270 ms** |

## πŸ›‘οΈ Stress and Safety Report (v0.5.7)

Tequel has been submitted to rigorous statistical tests:

### **1. Avalanche Effect (SAC)**

We measured the **Strict Avalanche Criterion** to ensure that a single bit change in input results in a radical change in output.
- **Result:** **52.26% Avalanche** (The cryptographic "Sweet Spot").
- **Collision Resistance:** **110,600,000+ iterations** without a single collision found.

### **2. Shannon Entropy Analysis**

We measured the unpredictability of generated bytes to ensure the output is indistinguishable from pure random noise.
- **Result:** **7.999986 bits/byte** (Theoretical maximum: **8.0**).
- **Status: πŸ† Excellent.** Statistical parity with **SHA-256** and **AES** in bit distribution.

### **3. Memory Forensic Resistance**

- **Mechanism:** Full integration with the `zeroize` framework.
- **Protection:** All sensitive buffers (Keys, Salts, and Plaintext) are overwritten with zeros immediately after use, mitigating **Cold Boot Attacks**.

## βš™οΈ Core Features


- **Confidentiality**: ARX-based masking with bitwise wrapping and dynamic rotations.
- **Integrity (MAC)**: Built-in Message Authentication to prevent data tampering.
- **Advanced KDF:** Key stretching with configurable iterations to thwart Brute-Force and GPU-accelerated attacks.
- **Encrypt-then-MAC (EtM)**: Industry-standard architecture for superior security.

## πŸ“₯ Installation & Usage


Add to your `Cargo.toml`:

```toml
[dependencies]
tequel-rs = "0.5.7"
```

## Basic Hashing


```rust
use tequel_rs::hash::TequelHash

fn main() {
  let mut teq = TequelHash::new()
    .with_salt("project_salt")
    .with_iterations(32);

  let hash = teq.dt_hash_string("my_secure_data");
}
```

## πŸ”‘ Key Derivation (KDF)


Perfect for deriving encryption keys from user passwords (used in **My Way CLI**).

```rust
let mut teq = TequelHash::new();
// Derives a 256-bit key from a password using 1000 iterations
let key = teq.derive_key("user_password", "unique_salt", 1000);
```

## Why the name 'Tequel'?


"Tequel" is a biblical reference from the Book of Daniel (5:25-28).

"Mene, Mene, Tequel, Parsim"

TEQUEL means "Weighed". In the biblical context, it represented a divine judgment where a kingdom was weighed and found wanting. I chose this name to represent the cryptographic weight and robustness of the libraryβ€”data secured by Tequel is "weighed" and protected by a hand that cannot be easily bypassed.

## License


**MIT License** - free to use, modify, and integrate.