Registry / data / galois

galois

JSON →
library0.4.11pypypi✓ verified 90d ago

The `galois` library is a performant Python package that extends NumPy arrays to operate over finite fields (Galois fields) for various mathematical and cryptographic applications. It leverages Numba and LLVM for just-in-time compilation to optimize finite field arithmetic, often outperforming native NumPy operations for modular arithmetic. It supports all Galois fields GF(p^m), offering functionalities for linear algebra, polynomials, forward error correction codes (BCH, Reed-Solomon), and number theoretic functions. Currently at version 0.4.10, the library maintains an active release cadence, with updates typically arriving monthly or bi-monthly.

pip install galois
INSTALL
IMPORT
SIG · GALOIS
G
galois
datapythonv0.4.11
Install
7.1s avg
Import
3746ms
Disk
284MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.4.11 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.910 runs
build_error
glibc
py 3.10–3.910 runs
installs and imports cleanly · install 7.1s · import 3.746s · 285MB
284MB installed
● package 284MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

galois
✓ import galois
GF
✓ GF = galois.GF(p**m)
✗ GF = galois.Field(p**m)
`galois.Field()` was deprecated in v0.4.10 and is slated for removal in v0.5.0. Use `galois.GF()` instead.
Poly
✓ P = galois.Poly([1, 0, 1], field=GF)

This quickstart demonstrates how to define a Galois field, create `FieldArray` instances which inherit from NumPy arrays, and perform basic arithmetic operations within that finite field. The `galois.GF()` factory function is used to create the field class.

import galois import numpy as np # Define a Galois field, e.g., GF(3^5) GF = galois.GF(3**5) print(f"Galois Field properties:\n{GF.properties}") # Create FieldArray instances (which are subclasses of np.ndarray) x = GF([236, 87, 38, 112]) y = GF(np.array([109, 201, 2, 45])) print(f"\nx (type: {type(x)}): {x}") print(f"y (type: {type(y)}): {y}") # Perform arithmetic operations in the finite field result_add = x + y result_mul = x * y print(f"\nx + y: {result_add}") print(f"x * y: {result_mul}")
Debug
Known issues
breakingThe `galois.Field()` class factory function was deprecated in `galois` v0.4.10 and is scheduled for removal in v0.5.0.
fix
Migrate all calls from `galois.Field()` to `galois.GF()`. They are functionally equivalent.
affects: >=0.4.10
breakingAs of `galois` v0.3.0, several keyword arguments for `galois.GF()` and `galois.Field()` (e.g., `irreducible_poly`, `primitive_element`, `verify`, `compile`, `repr`) can no longer be passed as positional arguments.
fix
Always pass these specific arguments by keyword, not by position. For example, use `galois.GF(p**m, irreducible_poly=poly)` instead of `galois.GF(p**m, poly)`.
affects: >=0.3.0
gotchaThe algorithms implemented in `galois` are designed for performance, not constant-time execution. This means the library could be vulnerable to side-channel timing attacks.
fix
Do not use `galois` for production security-sensitive applications where constant-time arithmetic is a requirement. It is intended for research, development, cryptanalysis, and education.
affects: All versions
gotcha`galois` depends heavily on Numba, which has historically had tight and sometimes incompatible dependencies with specific NumPy versions. This can lead to issues during installation or runtime if the installed NumPy and Numba versions are not compatible.
fix
If encountering `ImportError` or other runtime issues related to NumPy/Numba, check the official `galois` documentation for its recommended `numpy` and `numba` versions. Consider installing `numpy` and `numba` first, or using a virtual environment to isolate dependencies.
affects: All versions
Errors
Common errors & fixes
AttributeError: module 'galois' has no attribute 'Field'
Attempting to use the `galois.Field()` class factory after it has been removed in a future version (v0.5.0).
fix
Replace `galois.Field(...)` with `galois.GF(...)`.
TypeError: galois.GF() takes no positional arguments for 'irreducible_poly'
Passing keyword-only arguments like `irreducible_poly` or `primitive_element` positionally to `galois.GF()` (or `galois.Field()`) since v0.3.0.
fix
Ensure all such arguments are passed by keyword, e.g., `galois.GF(2**8, irreducible_poly=poly)`.
TypeError: arithmetic operation between FieldArray instances with different irreducible polynomials of order GF(p^m)
Performing arithmetic between two `FieldArray` instances that represent elements from different Galois fields. Even if they have the same order (p^m), they must be defined with the exact same irreducible polynomial to be compatible.
fix
Ensure both `FieldArray` instances are created from the *exact same* `GF` class. If necessary, explicitly cast one array to the field of the other using `GF_target(array_source)` if the conversion is meaningful and defined.
ImportError: DLL load failed while importing unicodedata: The specified module could not be found.
This issue was specifically reported with Python 3.10.1, likely due to a specific incompatibility between Numba's compiled components and that Python patch version.
fix
If on Python 3.10.1, try upgrading to a later Python 3.10.x release, Python 3.11+, or downgrading to Python 3.9. Ensure Numba and NumPy are also updated to their latest compatible versions.
Upgrade
Version history
0.4.11latest on PyPI · released May 2, 2026
Audit
Dependencies
numpyrequired`galois` is built as an extension to NumPy arrays and is completely dependent on it for array operations.
numbarequired`galois` heavily relies on Numba for just-in-time compilation to optimize the performance of finite field arithmetic.
typing_extensionsrequiredUsed for type hinting, especially for compatibility across different Python versions.
Agent activity
26 hits · last 30 days
node
22
Amazon
1
OpenAI (training)
1
Resources
galois — pip install galois · libregistry