# Tequel



*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.
| **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.