tequel/lib.rs
1/*
2 * Tequel-rs: High-Density 384-bit Cryptographic Hash Engine
3 * Copyright (C) 2026 Gabriel Xavier (dotxav)
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as published
7 * by the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 */
15
16pub mod error;
17pub mod hash;
18pub mod encrypt;
19pub mod rng;
20pub mod avx2_inline;
21
22
23// --- FFI Boundary ---
24
25#[unsafe(no_mangle)]
26pub extern "C" fn tequel_hash_raw(data: *const u8, len: usize, out: *mut u8) {
27 let input = unsafe { std::slice::from_raw_parts(data, len) };
28
29 let mut teq = hash::TequelHash::new();
30 let hash_result = teq.tqlhash_raw(input);
31
32 unsafe {
33 std::ptr::copy_nonoverlapping(hash_result.as_ptr(), out, 48);
34 }
35}