npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lib-q/hqc

v0.0.7

Published

HQC KEM (NIST PQC) for Node.js

Readme

lib-q-hqc

Post-quantum HQC (Hamming Quasi-Cyclic) KEM implementation for libQ.

Enable from the KEM façade with hqc on lib-q-kem.

Overview

Pure-Rust HQC KEM for parameter sets HQC-128, HQC-192, and HQC-256 (internal names HQC-1, HQC-3, HQC-5). The crate follows libQ provider patterns, supports no_std and WASM, and offers optional AVX2 acceleration with portable fallback.

Implementation status

Not production-ready. Core modules (Reed–Solomon, Reed–Muller, concatenated code, PKE, KEM, SHAKE256 PRNG) are implemented and covered by tests. Randomized encrypt/decrypt and encapsulate/decapsulate round-trips are verified across all parameter sets (portable and AVX2 paths). Remaining blockers are full NIST KEM KAT conformance and independent side-channel evaluation — see docs/audit-package/README.md for verified facts and open findings. Do not deploy for confidentiality guarantees until those findings are closed.

Security levels

Object sizes match lib-q-types::hqc (workspace source of truth for wire lengths):

| Algorithm | Security | Public key | Secret key | Ciphertext | Shared secret | |-----------|----------|------------|------------|------------|---------------| | HQC-128 | 128 bits | 2,241 B | 2,337 B | 4,433 B | 32 B | | HQC-192 | 192 bits | 4,522 B | 4,618 B | 8,978 B | 32 B | | HQC-256 | 256 bits | 7,245 B | 7,341 B | 14,421 B | 32 B |

Secret key layout: ek_pkedk_pke (32) ‖ sigma (16) ‖ seed_kem (48).

Features

  • Three parameter sets: hqc128, hqc192, hqc256 (or hqc for all)
  • libQ provider integration and typed key/ciphertext wrappers
  • zeroize for sensitive buffers; no_std and wasm targets
  • Pure Rust (no C/FFI); BearSSL-compatible and standard AES DRBG backends
  • Optional simd-avx2 (runtime detection, bit-exact portable fallback)

Architecture

| Module | Role | |--------|------| | hqc_kem | KEM encapsulation / decapsulation | | hqc_pke | Public-key encryption layer | | params_correct | Parameter sets HQC-1 / HQC-3 / HQC-5 | | concatenated_code | Reed–Solomon + Reed–Muller concatenated code | | reed_solomon, reed_muller | Constituent codes | | internal | Polynomial / vector primitives, SHAKE256 | | provider | libQ KEM provider |

Optional KAT DRBG backends (not enabled by default): kat-drbg / bearssl-aes (reference-compatible) and aes-drbg (pure Rust NIST CTR_DRBG). Production RNG uses lib-q-random via the random feature.

See SIMD architecture and vector operations.

Usage

use lib_q_random::LibQRng;
use lib_q_hqc::hqc_core_impl::*;

let mut rng = LibQRng::new_deterministic([42u8; 32]);
let keypair = Hqc128CoreImpl::generate_keypair(&mut rng);

let (ciphertext, shared_secret1) = Hqc128CoreImpl::encapsulate(&keypair.public_key, &mut rng)
    .expect("encapsulation");
let shared_secret2 = Hqc128CoreImpl::decapsulate(&keypair.secret_key, &ciphertext)
    .expect("decapsulation");

assert_eq!(shared_secret1.as_slice(), shared_secret2.as_slice());

Integration tests exercise KEM round-trips with both pinned seeds (for reproducible shared-secret comparison) and many varied keypairs across all parameter sets (test_kem_roundtrip_varied_keys_all_params).

Testing

cargo test -p lib-q-hqc --features alloc,hqc
cargo test -p lib-q-hqc --test integration_test --features alloc,hqc128
cargo test -p lib-q-hqc --features "simd-avx2,alloc,hqc128" --test simd_correctness

See tests/README.md for the test layout. Diagnostic and historical debug tests live under tests/archive/.

SIMD (AVX2)

cargo build --release -p lib-q-hqc --features simd-avx2
cargo bench -p lib-q-hqc --features "simd-avx2,alloc,hqc128" --bench simd_benchmarks

Requires x86_64 with AVX2; falls back to portable code when unavailable.

Known limitations

Documented in SECURITY.md and docs/audit-package/README.md:

  • No independent side-channel evaluation; constant-time discipline in source only.
  • Full NIST KEM KAT conformance is not yet established by a non-ignored test suite.

Security

See SECURITY.md. Report vulnerabilities via the workspace SECURITY.md policy.

License

Same terms as the main libQ workspace.

Subresource integrity (SHA-384)

Paths in integrity-manifest.json are relative to the package root (including web/ and nodejs/ when both ship).