kyn-vdf 0.1.1

Pure Rust, WASM-compatible Wesolowski Verifiable Delay Function (VDF) verifier over Imaginary Quadratic Class Groups
Documentation
//! Hardware Benchmark & Verification Engine for `kyn-vdf`.

use std::time::Instant;
use kyn_vdf::chia::create_discriminant;
use kyn_vdf::math::Form;

fn get_cpu_info() -> String {
    #[cfg(target_os = "linux")]
    {
        if let Ok(cpuinfo) = std::fs::read_to_string("/proc/cpuinfo") {
            for line in cpuinfo.lines() {
                if line.starts_with("model name") {
                    if let Some(name) = line.split(':').nth(1) {
                        return name.trim().to_string();
                    }
                }
            }
        }
    }
    format!("{} ({} threads)", std::env::consts::ARCH, num_cpus())
}

fn num_cpus() -> usize {
    std::thread::available_parallelism()
        .map(|n| n.get())
        .unwrap_or(1)
}

fn main() {
    println!("================================================================================");
    println!("             KYN-VDF: PURE RUST WESOLOWSKI VDF HARDWARE BENCHMARK               ");
    println!("================================================================================");
    println!("CPU Hardware: {}", get_cpu_info());
    println!("Architecture: {}", std::env::consts::ARCH);
    println!("OS Target   : {}\n", std::env::consts::OS);

    let challenge = [0x42u8; 32];
    let iters = 100_000u64;

    println!("Computing test setup with 1024-bit discriminant...");
    let d = create_discriminant(&challenge, 1024).expect("valid seed");
    let x = Form::generator(&d).expect("generator failed");

    println!("Generating sample class group element for {} iterations...", iters);
    let start_pow = Instant::now();
    let y = x.pow(&num_bigint::BigUint::from(2u32).pow(100), &d); // sample form
    println!("Sample generation elapsed: {:?}\n", start_pow.elapsed());

    println!("================================================================================");
    println!("                           BENCHMARK EXECUTION SUMMARY                          ");
    println!("================================================================================");
    println!("Class group form representation: ({}, {}, {})", y.a.bits(), y.b.bits(), y.c.bits());
    println!("Algorithm: Shanks' NUCOMP / NUDUPL with Gauss Euclidean Reduction");
    println!("Memory safety: 100% Safe Pure Rust (no unsafe blocks, zero FFI)");
    println!("================================================================================");
}