--- id: galois version: "0.4.11" license: MIT license_treatment: permissive maintenance: active --- # galois — A performant NumPy extension for Galois fields and their applications License: permissive · Maintenance: active · Downloads: 269.8K/mo ## What it is and what it does Galois is a NumPy extension that lets you create arrays that perform all arithmetic in a finite field GF(p^m) instead of over real numbers. You define a field using galois.GF(p**m), which returns a FieldArray subclass that behaves like a NumPy array but enforces finite-field arithmetic on all operations. Internally, it replaces NumPy's universal functions with specialized versions compiled by Numba, configurable to use either lookup tables for speed or explicit calculation for memory efficiency. The library targets research, cryptanalysis, education, and reverse engineering rather than production security (the algorithms are not constant-time and vulnerable to timing attacks). It includes support for linear algebra over finite fields, polynomial operations, forward error correction codes (BCH, Reed-Solomon), linear-feedback shift registers, and number-theoretic functions like factorization and primality testing. Use it for: - Implement Reed-Solomon or BCH error correction codes for data transmission or storage systems. - Perform polynomial arithmetic and factorization over finite fields for cryptanalysis or algorithm research. - Conduct linear algebra computations (matrix operations, solving systems) constrained to a finite field. - Prototype or analyze cryptographic algorithms that operate on Galois fields without writing low-level modular arithmetic. - Generate or test irreducible, primitive, and Conway polynomials for finite field construction. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Galois extends NumPy arrays to perform arithmetic operations over finite fields (Galois fields), enabling efficient computation in GF(p^m) with a NumPy-compatible interface. Yes. The package is actively maintained, has no known vulnerabilities, installs with low friction, and uses a permissive MIT license. It fills a clear niche for finite-field arithmetic in Python with NumPy integration. The non-constant-time implementation is explicitly documented as unsuitable for production security but appropriate for research and education, so install only if that scope matches your use case. ## Install pip install galois uv add galois poetry add galois ## Installing galois Before you install: Low friction: pure Python wheel with three runtime dependencies (numpy, numba, typing_extensions). Active maintenance with recent release (104 days ago) and 471 GitHub stars. Supports Python 3.7 through 3.14. License in practice: MIT license (permissive) places no restrictions on use, modification, or distribution in commercial or private projects. Quickstart: pip install galois import galois import numpy as np GF = galois.GF(3**5) x = GF([236, 87, 38, 112]) y = GF([109, 17, 108, 224]) z = x * y # multiplication in GF(3^5) Verify before relying: - Performance comparison claims ('faster than native NumPy') lack quantitative benchmarks in the fact sheet. - Whether lookup-table vs. explicit-calculation trade-off is configurable per operation or globally. - Exact scope of supported polynomial operations beyond univariate polynomials mentioned. - Whether the library's non-constant-time algorithms pose a practical risk for intended use cases (research, education, cryptanalysis). ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 269.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags galois field arithmetic, finite field numpy, GF(p^m) arrays, error correction codes, reed solomon BCH, cryptography finite fields, polynomial arithmetic modular, finite-fields, cryptanalysis, error-correction [View on SkillFed](https://skillfed.io/packages/galois) · [View on PyPI](https://pypi.org/project/galois/)