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

@digitaldefiance/node-fhe-accelerate

v0.1.4

Published

NOT YET IMPLEMENTED. Apple Silicon hardware detection and modular-arithmetic primitives. No FHE operations exist: createEngine() rejects. Do not use for encryption.

Readme

@digitaldefiance/node-fhe-accelerate

Hardware-accelerated NTT and modular arithmetic primitives for Apple Silicon. The foundation for an FHE library, not yet a complete one.

Status

What works today:

  • NttProcessor — negacyclic Number Theoretic Transform over Z_q[X]/(X^N + 1). Cooley-Tukey with NEON butterflies when available. Verified with the convolution identity gate (not a round-trip — round-trips cannot catch the defect class this library was built to remove). 0.096ms at N=1024 on M4 Max.
  • ModularArithmetic — Montgomery multiplication, modular add/sub, to/from Montgomery form.
  • detectHardware() — reports SME, Metal, NEON availability on this machine.

What does not exist:

  • Polynomial ring multiplication (the orchestration layer over NTT — see roadmap)
  • Key generation, encryption, decryption
  • Homomorphic operations (add, multiply, relinearize, bootstrap)
  • Noise sampling
  • Any complete FHE scheme (TFHE, BFV, CKKS)

createEngine() rejects with "Not yet implemented." The ZK proof entry points throw. Do not use this for encryption or for zero-knowledge proofs.

Install

npm install @digitaldefiance/apple-silicon-caps

Requires macOS arm64 and Xcode Command Line Tools (for the native build).

Usage

const { NttProcessor, ModularArithmetic, detectHardware } = require('@digitaldefiance/node-fhe-accelerate');

// Hardware detection
const hw = detectHardware();
console.log(hw); // { hasSme: true, hasMetal: true, hasNeon: true, ... }

// NTT: negacyclic polynomial multiplication
const N = 1024;
const q = 132120577; // NTT-friendly prime, q ≡ 1 (mod 2N)
const ntt = new NttProcessor(N, q);

const a = new Array(N).fill(0); a[0] = 1; a[1] = 2;
const b = new Array(N).fill(0); b[0] = 3; b[1] = 4;

const aNtt = ntt.forward(a);
const bNtt = ntt.forward(b);

// Pointwise multiply in NTT domain (use ModularArithmetic or BigInt)
const mulmod = (x, y) => Number(BigInt(x) * BigInt(y) % BigInt(q));
const cNtt = aNtt.map((v, i) => mulmod(v, bNtt[i]));

const c = ntt.inverse(cNtt);
// c = a * b in Z_q[X]/(X^N + 1)

// Modular arithmetic
const ma = new ModularArithmetic(q);
console.log(ma.montgomeryMul(ma.toMontgomery(7), ma.toMontgomery(9)));

Roadmap

What FHE needs, in dependency order. Checked items exist; unchecked items do not.

  • [x] Modular arithmetic — Montgomery multiplication, add, sub
  • [x] NTT — negacyclic Cooley-Tukey, forward and inverse, NEON path
  • [x] Hardware detection — SME, Metal, NEON, topology
  • [ ] Polynomial ring — multiply/add/sub over Z_q[X]/(X^N+1) via NTT. Next step. The NTT does the heavy lifting; this is the forward/pointwise/inverse orchestration.
  • [ ] Noise sampling — discrete Gaussian or centered binomial distribution
  • [ ] Key generation — LWE/GLWE secret keys, public keys
  • [ ] Encryption / Decryption — RLWE samples, rounding
  • [ ] Homomorphic addition — coefficient-wise add on ciphertexts
  • [ ] Key switching — gadget decomposition, external product
  • [ ] Homomorphic multiplication — tensor product + relinearization
  • [ ] Bootstrapping — blind rotation, sample extraction. The research frontier of FHE.

Each layer builds on the ones above it. The polynomial ring is achievable in a session; bootstrapping is a research project.

Correctness methodology

This library uses the negacyclic convolution identity as its correctness gate, not round-trip tests. The reason: the Cooley-Tukey / Gentleman-Sande butterfly pair is 2·I for any nonzero twiddle, so a forward-then-inverse round-trip passes even with completely wrong twiddle tables. The convolution identity — sparse operands with X^(N-1) populated so the X^N = -1 sign flip is exercised — catches the defect because it requires the psi twist to be a genuine 2N-th root of unity.

This methodology is documented in detail in the companion paper at fhe-evolve, §6.6 "Round-Trip Verification Is Insufficient."

History

Versions 0.1.0 and 0.1.1 are deprecated. 0.1.0 could not be imported (extensionless ESM re-exports). Its ZK proof subsystem simulated verification by sleeping via setTimeout and returning valid: true for any proof input, including for ballot validity and voter eligibility. That code now throws.

Platform

macOS arm64 only. Requires Xcode Command Line Tools for the native build at install time.

License

MIT. Copyright (c) 2025 Digital Defiance, Jessica Mulein.