灵符lingfu

ling-lang

↓ 0 downloads

Ling - The Omniglot Systems Language

Keywords systems, polyglot, ai, crypto, game
lingfu install ling-lang
LicenseApache-2.0 OR MIT
AuthorsLing Lin, Sanny Lin
READMECode / FilesVersionsDependency GraphDependentsSecurityBuildsSettings

Code / Files (995)

crates/ling-crypto/src/lib.rs
//! Ling cryptography — classical + post-quantum primitives.
//!
//! # `std` vs `no_std`
//! This crate is `no_std`-capable. With the default `std` feature it uses the
//! OS CSPRNG and offers Argon2 PHC password strings, exactly as before. Built
//! `--no-default-features --features alloc` (e.g. inside the LingOS kernel) it
//! needs only `core` + `alloc`; the caller must first install an entropy source
//! with [`rng::set_entropy_source`] (the kernel wires this to RDRAND). Every
//! algorithm is byte-identical across both builds — the only difference is where
//! random bytes come from and whether the two Argon2 *PHC-string* helpers exist.
//!
//! # Modules
//! - [`hash`] — BLAKE3, SHA3-256/512, SHAKE-256
//! - [`symmetric`] — AES-256-GCM, XChaCha20-Poly1305
//! - [`asymmetric`] — Ed25519 signatures, X25519 ECDH
//! - [`kdf`] — Argon2id, HKDF-SHA3
//! - [`pq`] — ML-KEM-768 (post-quantum KEM, FIPS 203) — real implementation
//! - [`pq_sig`] — ML-DSA-65 and ML-DSA-87 (post-quantum signatures, FIPS 204)
//! - [`hybrid`] — X25519 + ML-KEM-768 hybrid KEM (the PQ-migration primitive)
//! - [`geo`] — Geometric suite: knot identities (PQ KEM), 3-D knot key
//!   fingerprints, and a 4-D holographic all-or-nothing transform
//! - [`shamir`] — Shamir's Secret Sharing over GF(2⁸)
//! - [`zkp`] — Schnorr zero-knowledge proof of knowledge
//! - [`vrf`] — Verifiable Random Function (Ed25519-based)
//! - [`mandala`] — Mandala Hash — custom geometric key derivation
//! - [`mobius_helix`] — DICE-42, the Möbius-Helix Reactor — keyed
//!   dice/torus/helix cascade layer for `lingtp://`, meant to wrap the AEAD
//!   frame layer for defense-in-depth (not a replacement for
//!   ML-DSA-87/ML-KEM-768/XChaCha20)
//! - [`lw`] — ling-wallet LW-1 primitives (std only): domain-separated
//!   SHAKE256, X25519+ML-KEM-1024, ML-DSA-87 identities, Argon2id, AEAD and
//!   the experimental LRS-87 lattice linkable ring signature
//! - [`hypertorus`] — HyperTorus memory-hard proof-of-work (std only)

#![cfg_attr(not(feature = "std"), no_std)]

extern crate alloc;

pub mod rng;

pub mod asymmetric;
pub mod geo;
pub mod hash;
pub mod hybrid;
pub mod kdf;
pub mod mandala;
pub mod mobius_helix;
pub mod pq;
pub mod pq_sig;
pub mod shamir;
pub mod symmetric;
pub mod vrf;
pub mod zkp;

// ling-wallet (LW-1) primitives: hashing, X25519+ML-KEM-1024 KEM, ML-DSA-87
// identities, AEAD, Argon2id, LRS-87 lattice ring signatures, and the
// HyperTorus proof-of-work. std-only (OnceLock-cached matrices, 16 MiB pad).
#[cfg(feature = "std")]
pub mod hypertorus;
#[cfg(feature = "std")]
pub mod lw;

pub use asymmetric::{Ed25519Keypair, X25519Secret};
pub use geo::{
    gather, holo_hash, holo_open, holo_seal, knot_encapsulate, scatter, HoloFragment, KnotIdentity,
    KnotShape,
};
pub use hash::{Blake3, Sha3_256, Sha3_512, Shake256};
pub use hybrid::{encapsulate as hybrid_encapsulate, HybridKeypair};
pub use kdf::{hkdf_sha3, Argon2idParams};
pub use mandala::{MandalaHash, MandalaParams};
pub use mobius_helix::{
    DieType as MobiusDieType, MobiusHelixParams, MobiusHelixReactor, NAME as DICE_42,
};
pub use pq::{encapsulate as mlkem768_encapsulate, MlKem768Keypair};
pub use pq_sig::{MlDsa65Keypair, MlDsa87Keypair};
pub use shamir::{reconstruct_secret, split_secret, Share};
pub use symmetric::{AesGcm256, XChaCha20};
pub use vrf::{VrfKeypair, VrfProof};
pub use zkp::{SchnorrKeypair, SchnorrProof};

← Back to index