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

galois-field-gf256

v1.2.0

Published

Finite field GF(2^8) arithmetic with the AES reduction polynomial: multiply, inverse, exp/log tables and Reed-Solomon helpers.

Readme

galois-field-gf256

Arithmetic over the finite field GF(2^8), using the same irreducible polynomial as AES: x^8 + x^4 + x^3 + x + 1 (0x11B). Handy for building Reed-Solomon codecs, AES internals, or any bytewise finite-field code.

Zero dependencies. Pure ESM.

Install

npm install galois-field-gf256

Usage

import { gmul, mul, inverse, div, pow } from "galois-field-gf256";

gmul(0x57, 0x83); // 0xC1  (the AES spec example)
mul(0x53, inverse(0x53)); // 1
div(0x06, 0x02); // 0x03
pow(0x02, 8); // 0x1B

API

| Function | Description | | --------------- | ------------------------------------------------------------------ | | gadd(a, b) | Field addition — this is just XOR. | | gsub(a, b) | Subtraction — identical to addition in characteristic 2. | | gmul(a, b) | Carry-less multiply with on-the-fly reduction (no tables). | | mul(a, b) | Table-driven multiply. Same result as gmul, faster for hot loops.| | inverse(a) | Multiplicative inverse. Throws for a === 0. | | div(a, b) | a * inverse(b). Throws for b === 0. | | pow(a, n) | Integer power; negative n uses the inverse. | | exp(i) | generator^i where the generator is 0x03. | | log(a) | Discrete log base the generator. Throws for a === 0. |

Notes

The exp/log tables are built at import time from the primitive element 0x03. All bytes are masked to 8 bits, so passing larger integers is safe (only the low byte is used).

License

MIT