pub struct TequelHash {
pub states: [u32; 12],
pub salt: String,
pub iterations: u32,
}Expand description
TequelHash provides hash functions, custom iterations and salt.
Fields§
§states: [u32; 12]§salt: String§iterations: u32Implementations§
Source§impl TequelHash
impl TequelHash
pub fn new() -> Self
pub fn with_salt(self, salt: &str) -> Self
pub fn with_iteration(self, value: u32) -> Self
Sourcepub fn tqlhash(&mut self, input: &[u8]) -> String
pub fn tqlhash(&mut self, input: &[u8]) -> String
Generates a unique 384-bit hexadecimal hash from the input data.
This function is the core of the Tequel engine, utilizing SIMD/AVX2 /// instructions to process data in 256-bit blocks. It is designed for high-speed performance and maximum bit diffusion.
§Performance
By leveraging hardware acceleration, tqlhash achieves significantly lower
latency compared to scalar implementations, making it ideal for
large-scale data integrity checks and real-time obfuscation.
§Determinism
The algorithm is strictly deterministic. Providing the same input bytes will always yield the exact same hexadecimal string.
§Arguments
input- The raw data bytes (&[u8]) to be hashed.
§Returns
A 96-character hexadecimal String (12 x 32-bit internal states).
§Example
use tequel::hash::TequelHash;
let mut tequel = TequelHash::new();
let data = b"secret_data";
let hash_a = tequel.tqlhash(data);
let hash_b = tequel.tqlhash(data);
assert_eq!(hash_a, hash_b);
println!("Hash: {}", hash_a);Sourcepub fn tqlhash_raw(&mut self, input: &[u8]) -> [u8; 48]
pub fn tqlhash_raw(&mut self, input: &[u8]) -> [u8; 48]
Generates a unique 384-bit hexadecimal hash from the input data.
This function is the core of the Tequel engine, utilizing SIMD/AVX2 /// instructions to process data in 256-bit blocks. It is designed for high-speed performance and maximum bit diffusion.
§Performance
By leveraging hardware acceleration, tqlhash_raw achieves significantly lower
latency compared to scalar implementations, making it ideal for
large-scale data integrity checks and real-time obfuscation.
§Determinism
The algorithm is strictly deterministic. Providing the same input bytes will always yield the exact same hexadecimal string.
§Arguments
input- The raw data bytes (&[u8]).
§Returns
A 32-bit list [u8; 32]
§Example
use tequel::hash::TequelHash;
let mut tequel = TequelHash::new();
let data = b"secret_data";
let bytes_a = tequel.tqlhash_raw(data);
let bytes_b = tequel.tqlhash_raw(data);
assert_eq!(bytes_a, bytes_b);
println!("bytes: {:?}", bytes_a);Sourcepub fn isv_tqlhash(&mut self, hash: &String, input: &[u8]) -> bool
pub fn isv_tqlhash(&mut self, hash: &String, input: &[u8]) -> bool
Verifies if a given hash matches the original input data.
This is a convenience function that re-hashes the provided input
and performs a comparison against the existing hash string.
§Security
The verification process leverages the TQL-11 SIMD engine to ensure high-speed integrity checks. It is ideal for verifying file integrity or checking stored credentials.
§Arguments
hash- The pre-computed hexadecimal hash string to be verified.input- The raw bytes (&[u8]) of the data to check.
§Returns
Returns true if the re-computed hash matches the provided one, false otherwise.
§Example
use tequel::hash::TequelHash;
let mut tequel = TequelHash::new();
let data = b"secret_message";
let hash = tequel.tqlhash(data);
if tequel.isv_tqlhash(&hash, data) {
println!("Integrity verified: VALID!");
} else {
println!("Integrity compromised: NOT VALID!");
}Sourcepub fn derive_key(&mut self, password: &str, iterations: u32) -> [u8; 32]
pub fn derive_key(&mut self, password: &str, iterations: u32) -> [u8; 32]
Derives a high-entropy cryptographic key from a password and a salt.
This function implements a Key Derivation Function (KDF) powered by the TQL-11 engine. It utilizes a “Key Stretching” mechanism to make brute-force and dictionary attacks computationally expensive.
§Architecture
The process is SIMD-accelerated (AVX2), ensuring that the computational cost remains high for attackers (who must replicate the intensive TQL-11 rounds) while staying efficient for legitimate local use. Every iteration triggers a non-linear mutation with a validated 51% avalanche diffusion.
§Arguments
password- The raw bytes of the master password (e.g., from user input).salt- A unique, random value used to prevent Rainbow Table attacks.iterations- The number of hashing rounds. Higher values increase resistance against GPU-accelerated cracking (Recommended: >1000).
§Returns
A 384-bit hexadecimal String representing the derived cryptographic key.
§Example
use tequel::hash::TequelHash;
fn main() {
let mut teq = TequelHash::new();
let key = teq.derive_key("master_password_123", 2048);
println!("Derived Key: {:?}", key);
}Trait Implementations§
Source§impl Clone for TequelHash
impl Clone for TequelHash
Source§fn clone(&self) -> TequelHash
fn clone(&self) -> TequelHash
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more