galois


Namegalois JSON
Version 0.4.2 PyPI version JSON
download
home_pageNone
SummaryA performant NumPy extension for Galois fields and their applications
upload_time2024-09-06 00:03:38
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT
keywords aes bch cryptography ecc elliptic curve cryptography elliptic curves encryption error correction fec finite field galois field golay hamming numpy reed solomon rsa
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ![Galois: A performant NumPy extension for Galois fields and their applications](https://raw.githubusercontent.com/mhostetter/galois/main/logo/galois-heading.png)

<div align=center>
  <a href="https://pypi.org/project/galois"><img src="https://img.shields.io/pypi/v/galois"></a>
  <a href="https://pypi.org/project/galois"><img src="https://img.shields.io/pypi/pyversions/galois"></a>
  <a href="https://pypi.org/project/galois"><img src="https://img.shields.io/pypi/wheel/galois"></a>
  <a href="https://pypistats.org/packages/galois"><img src="https://img.shields.io/pypi/dm/galois"></a>
  <a href="https://pypi.org/project/galois"><img src="https://img.shields.io/pypi/l/galois"></a>
</div>
<div align=center>
  <a href="https://github.com/mhostetter/galois/actions/workflows/lint.yaml"><img src="https://github.com/mhostetter/galois/actions/workflows/lint.yaml/badge.svg?branch=main"></a>
  <a href="https://github.com/mhostetter/galois/actions/workflows/build.yaml"><img src="https://github.com/mhostetter/galois/actions/workflows/build.yaml/badge.svg?branch=main"></a>
  <a href="https://github.com/mhostetter/galois/actions/workflows/test.yaml"><img src="https://github.com/mhostetter/galois/actions/workflows/test.yaml/badge.svg?branch=main"></a>
  <a href="https://codecov.io/gh/mhostetter/galois"><img src="https://codecov.io/gh/mhostetter/galois/branch/main/graph/badge.svg?token=3FJML79ZUK"></a>
  <a href="https://twitter.com/galois_py"><img src="https://img.shields.io/static/v1?label=follow&message=@galois_py&color=blue&logo=twitter"></a>
</div>

The `galois` library is a Python 3 package that extends NumPy arrays to operate over finite fields.

> Enjoying the library? Give us a :star: on [GitHub](https://github.com/mhostetter/galois)!

The user creates a [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/) subclass using `GF = galois.GF(p**m)`.
`GF` is a subclass of `np.ndarray` and its constructor `x = GF(array_like)` mimics the signature of `np.array()`. The
[`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/) `x` is operated on like any other NumPy array except
all arithmetic is performed in $\mathrm{GF}(p^m)$, not $\mathbb{R}$.

Internally, the finite field arithmetic is implemented by replacing [NumPy ufuncs](https://numpy.org/doc/stable/reference/ufuncs.html).
The new ufuncs are written in pure Python and [just-in-time compiled](https://numba.pydata.org/numba-doc/dev/user/vectorize.html) with
[Numba](https://numba.pydata.org/). The ufuncs can be configured to use either lookup tables (for speed) or explicit calculation (for memory savings).

> **Warning**
> The algorithms implemented in the NumPy ufuncs are not constant-time, but were instead designed for performance. As such, the library could be vulnerable to a [side-channel timing attack](https://en.wikipedia.org/wiki/Timing_attack). This library is not intended for production security, but instead for research & development, reverse engineering, cryptanalysis, experimentation, and general education.

## Features

- Supports all [Galois fields](https://mhostetter.github.io/galois/latest/api/galois.GF/) $\mathrm{GF}(p^m)$, even arbitrarily large fields!
- [**Faster**](https://mhostetter.github.io/galois/latest/performance/prime-fields/) than native NumPy! `GF(x) * GF(y)` is faster than `(x * y) % p` for $\mathrm{GF}(p)$.
- Seamless integration with NumPy -- normal NumPy functions work on [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/)s.
- Linear algebra over finite fields using normal [`np.linalg`](https://mhostetter.github.io/galois/latest/basic-usage/array-arithmetic/#linear-algebra) functions.
- Linear transforms over finite fields, such as the FFT with [`np.fft.fft()`](https://mhostetter.github.io/galois/latest/basic-usage/array-arithmetic/#advanced-arithmetic) and the NTT with [`ntt()`](https://mhostetter.github.io/galois/latest/api/galois.ntt/).
- Functions to generate [irreducible](https://mhostetter.github.io/galois/latest/api/#irreducible-polynomials), [primitive](https://mhostetter.github.io/galois/latest/api/#primitive-polynomials), and [Conway](https://mhostetter.github.io/galois/latest/api/galois.conway_poly/) polynomials.
- Univariate polynomials over finite fields with [`Poly`](https://mhostetter.github.io/galois/latest/api/galois.Poly/).
- Forward error correction codes with [`BCH`](https://mhostetter.github.io/galois/latest/api/galois.BCH/) and [`ReedSolomon`](https://mhostetter.github.io/galois/latest/api/galois.ReedSolomon/).
- Fibonacci and Galois linear-feedback shift registers over any finite field with [`FLFSR`](https://mhostetter.github.io/galois/latest/api/galois.FLFSR/) and [`GLFSR`](https://mhostetter.github.io/galois/latest/api/galois.GLFSR/).
- Various [number theoretic functions](https://mhostetter.github.io/galois/latest/api/#number-theory).
- [Integer factorization](https://mhostetter.github.io/galois/latest/api/#factorization) and accompanying algorithms.
- [Prime number generation](https://mhostetter.github.io/galois/latest/api/#prime-number-generation) and [primality testing](https://mhostetter.github.io/galois/latest/api/#primality-tests).

## Roadmap

- Elliptic curves over finite fields
- Galois ring arrays
- GPU support

## Documentation

The documentation for `galois` is located at https://mhostetter.github.io/galois/latest/.

## Getting Started

The [Getting Started](https://mhostetter.github.io/galois/latest/getting-started/) guide is intended to assist the user with installing the
library, creating two example arrays, and performing basic array arithmetic. See [Basic Usage](https://mhostetter.github.io/galois/latest/basic-usage/array-classes/)
for more detailed discussions and examples.

### Install the package

The latest version of `galois` can be installed from [PyPI](https://pypi.org/project/galois/) using `pip`.

```console
$ python3 -m pip install galois
```

Import the `galois` package in Python.

```python
In [1]: import galois

In [2]: galois.__version__
Out[2]: '0.4.2'
```

### Create a [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/) subclass

Next, create a [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/) subclass
for the specific finite field you'd like to work in. This is created using the `galois.GF()` class factory. In this example, we are
working in $\mathrm{GF}(3^5)$.

```python
In [3]: GF = galois.GF(3**5)

In [4]: print(GF.properties)
Galois Field:
  name: GF(3^5)
  characteristic: 3
  degree: 5
  order: 243
  irreducible_poly: x^5 + 2x + 1
  is_primitive_poly: True
  primitive_element: x
```

The [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/) subclass `GF` is a subclass of
`np.ndarray` that performs all arithmetic in the Galois field $\mathrm{GF}(3^5)$, not in $\mathbb{R}$.

```python
In [5]: issubclass(GF, galois.FieldArray)
Out[5]: True

In [6]: issubclass(GF, np.ndarray)
Out[6]: True
```

See [Array Classes](https://mhostetter.github.io/galois/latest/basic-usage/array-classes/) for more details.

### Create two [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/) instances

Next, create a new [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/) `x` by passing an
[`ArrayLike`](https://mhostetter.github.io/galois/latest/api/galois.typing.ArrayLike/) object to `GF`'s constructor.

```python
In [7]: x = GF([236, 87, 38, 112]); x
Out[7]: GF([236,  87,  38, 112], order=3^5)
```

The array `x` is an instance of [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/) and also
an instance of `np.ndarray`.

```python
In [8]: isinstance(x, galois.FieldArray)
Out[8]: True

In [9]: isinstance(x, np.ndarray)
Out[9]: True
```

Create a second [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/) `y` by converting an existing
NumPy array (without copying it) by invoking `.view()`. When finished working in the finite field, view it back as a NumPy array
with `.view(np.ndarray)`.

```python
# y represents an array created elsewhere in the code
In [10]: y = np.array([109, 17, 108, 224]); y
Out[10]: array([109,  17, 108, 224])

In [11]: y = y.view(GF); y
Out[11]: GF([109,  17, 108, 224], order=3^5)
```

See [Array Creation](https://mhostetter.github.io/galois/latest/basic-usage/array-creation/) for more details.

### Change the element representation

The representation of finite field elements can be set to either the integer (`"int"`), polynomial (`"poly"`),
or power (`"power"`) representation. The default representation is the integer representation since integers are natural when
working with integer NumPy arrays.

Set the element representation by passing the `repr` keyword argument to `galois.GF()` or by calling the `repr()`
classmethod. Choose whichever element representation is most convenient.

```python
# The default is the integer representation
In [12]: x
Out[12]: GF([236,  87,  38, 112], order=3^5)

In [13]: GF.repr("poly"); x
Out[13]:
GF([2α^4 + 2α^3 + 2α^2 + 2,               α^4 + 2α,
             α^3 + α^2 + 2,      α^4 + α^3 + α + 1], order=3^5)

In [14]: GF.repr("power"); x
Out[14]: GF([α^204,  α^16, α^230,  α^34], order=3^5)

# Reset to the integer representation
In [15]: GF.repr("int");
```

See [Element Representation](https://mhostetter.github.io/galois/latest/basic-usage/element-representation/) for more details.

### Perform array arithmetic

Once you have two Galois field arrays, nearly any arithmetic operation can be performed using normal NumPy arithmetic.
The traditional [NumPy broadcasting rules](https://numpy.org/doc/stable/user/basics.broadcasting.html) apply.

Standard element-wise array arithmetic -- addition, subtraction, multiplication, and division -- are easily preformed.

```python
In [16]: x + y
Out[16]: GF([ 18,  95, 146,   0], order=3^5)

In [17]: x - y
Out[17]: GF([127, 100, 173, 224], order=3^5)

In [18]: x * y
Out[18]: GF([ 21, 241, 179,  82], order=3^5)

In [19]: x / y
Out[19]: GF([ 67,  47, 192,   2], order=3^5)
```

More complicated arithmetic, like square root and logarithm base $\alpha$, are also supported.

```python
In [20]: np.sqrt(x)
Out[20]: GF([ 51, 135,  40,  16], order=3^5)

In [21]: np.log(x)
Out[21]: array([204,  16, 230,  34])
```

See [Array Arithmetic](https://mhostetter.github.io/galois/latest/basic-usage/array-arithmetic/) for more details.

## Acknowledgements

The `galois` library is an extension of, and completely dependent on, [NumPy](https://numpy.org/). It also heavily
relies on [Numba](https://numba.pydata.org/) and the [LLVM just-in-time compiler](https://llvm.org/) for optimizing performance
of the finite field arithmetic.

[Frank Luebeck's compilation](http://www.math.rwth-aachen.de/~Frank.Luebeck/data/ConwayPol/index.html) of Conway polynomials and
[Wolfram's compilation](https://datarepository.wolframcloud.com/resources/Primitive-Polynomials/) of primitive polynomials are used
for efficient polynomial lookup, when possible.

[The Cunningham Book's tables](https://homes.cerias.purdue.edu/~ssw/cun/third/index.html) of prime factorizations, $b^n \pm 1$
for $b \in \{2, 3, 5, 6, 7, 10, 11, 12\}$, are used to generate factorization lookup tables. These lookup tables speed-up the
creation of large finite fields by avoiding the need to factor large integers.

[Sage](https://www.sagemath.org/) is used extensively for generating test vectors for finite field arithmetic and polynomial arithmetic.
[SymPy](https://www.sympy.org/en/index.html) is used to generate some test vectors. [Octave](https://www.gnu.org/software/octave/index)
is used to generate test vectors for forward error correction codes.

This library would not be possible without all of the other libraries mentioned. Thank you to all their developers!

## Citation

If this library was useful to you in your research, please cite us. Following the [GitHub citation standards](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files), here is the recommended citation.

### BibTeX

```bibtex
@software{Hostetter_Galois_2020,
    title = {{Galois: A performant NumPy extension for Galois fields}},
    author = {Hostetter, Matt},
    month = {11},
    year = {2020},
    url = {https://github.com/mhostetter/galois},
}
```

### APA

```
Hostetter, M. (2020). Galois: A performant NumPy extension for Galois fields [Computer software]. https://github.com/mhostetter/galois
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "galois",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "aes, bch, cryptography, ecc, elliptic curve cryptography, elliptic curves, encryption, error correction, fec, finite field, galois field, golay, hamming, numpy, reed solomon, rsa",
    "author": null,
    "author_email": "Matt Hostetter <matthostetter@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/fd/dd/88d9001205f90c0cdd1d07771f3b61e789836863b49e9123dda16596778f/galois-0.4.2.tar.gz",
    "platform": null,
    "description": "# ![Galois: A performant NumPy extension for Galois fields and their applications](https://raw.githubusercontent.com/mhostetter/galois/main/logo/galois-heading.png)\n\n<div align=center>\n  <a href=\"https://pypi.org/project/galois\"><img src=\"https://img.shields.io/pypi/v/galois\"></a>\n  <a href=\"https://pypi.org/project/galois\"><img src=\"https://img.shields.io/pypi/pyversions/galois\"></a>\n  <a href=\"https://pypi.org/project/galois\"><img src=\"https://img.shields.io/pypi/wheel/galois\"></a>\n  <a href=\"https://pypistats.org/packages/galois\"><img src=\"https://img.shields.io/pypi/dm/galois\"></a>\n  <a href=\"https://pypi.org/project/galois\"><img src=\"https://img.shields.io/pypi/l/galois\"></a>\n</div>\n<div align=center>\n  <a href=\"https://github.com/mhostetter/galois/actions/workflows/lint.yaml\"><img src=\"https://github.com/mhostetter/galois/actions/workflows/lint.yaml/badge.svg?branch=main\"></a>\n  <a href=\"https://github.com/mhostetter/galois/actions/workflows/build.yaml\"><img src=\"https://github.com/mhostetter/galois/actions/workflows/build.yaml/badge.svg?branch=main\"></a>\n  <a href=\"https://github.com/mhostetter/galois/actions/workflows/test.yaml\"><img src=\"https://github.com/mhostetter/galois/actions/workflows/test.yaml/badge.svg?branch=main\"></a>\n  <a href=\"https://codecov.io/gh/mhostetter/galois\"><img src=\"https://codecov.io/gh/mhostetter/galois/branch/main/graph/badge.svg?token=3FJML79ZUK\"></a>\n  <a href=\"https://twitter.com/galois_py\"><img src=\"https://img.shields.io/static/v1?label=follow&message=@galois_py&color=blue&logo=twitter\"></a>\n</div>\n\nThe `galois` library is a Python 3 package that extends NumPy arrays to operate over finite fields.\n\n> Enjoying the library? Give us a :star: on [GitHub](https://github.com/mhostetter/galois)!\n\nThe user creates a [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/) subclass using `GF = galois.GF(p**m)`.\n`GF` is a subclass of `np.ndarray` and its constructor `x = GF(array_like)` mimics the signature of `np.array()`. The\n[`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/) `x` is operated on like any other NumPy array except\nall arithmetic is performed in $\\mathrm{GF}(p^m)$, not $\\mathbb{R}$.\n\nInternally, the finite field arithmetic is implemented by replacing [NumPy ufuncs](https://numpy.org/doc/stable/reference/ufuncs.html).\nThe new ufuncs are written in pure Python and [just-in-time compiled](https://numba.pydata.org/numba-doc/dev/user/vectorize.html) with\n[Numba](https://numba.pydata.org/). The ufuncs can be configured to use either lookup tables (for speed) or explicit calculation (for memory savings).\n\n> **Warning**\n> The algorithms implemented in the NumPy ufuncs are not constant-time, but were instead designed for performance. As such, the library could be vulnerable to a [side-channel timing attack](https://en.wikipedia.org/wiki/Timing_attack). This library is not intended for production security, but instead for research & development, reverse engineering, cryptanalysis, experimentation, and general education.\n\n## Features\n\n- Supports all [Galois fields](https://mhostetter.github.io/galois/latest/api/galois.GF/) $\\mathrm{GF}(p^m)$, even arbitrarily large fields!\n- [**Faster**](https://mhostetter.github.io/galois/latest/performance/prime-fields/) than native NumPy! `GF(x) * GF(y)` is faster than `(x * y) % p` for $\\mathrm{GF}(p)$.\n- Seamless integration with NumPy -- normal NumPy functions work on [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/)s.\n- Linear algebra over finite fields using normal [`np.linalg`](https://mhostetter.github.io/galois/latest/basic-usage/array-arithmetic/#linear-algebra) functions.\n- Linear transforms over finite fields, such as the FFT with [`np.fft.fft()`](https://mhostetter.github.io/galois/latest/basic-usage/array-arithmetic/#advanced-arithmetic) and the NTT with [`ntt()`](https://mhostetter.github.io/galois/latest/api/galois.ntt/).\n- Functions to generate [irreducible](https://mhostetter.github.io/galois/latest/api/#irreducible-polynomials), [primitive](https://mhostetter.github.io/galois/latest/api/#primitive-polynomials), and [Conway](https://mhostetter.github.io/galois/latest/api/galois.conway_poly/) polynomials.\n- Univariate polynomials over finite fields with [`Poly`](https://mhostetter.github.io/galois/latest/api/galois.Poly/).\n- Forward error correction codes with [`BCH`](https://mhostetter.github.io/galois/latest/api/galois.BCH/) and [`ReedSolomon`](https://mhostetter.github.io/galois/latest/api/galois.ReedSolomon/).\n- Fibonacci and Galois linear-feedback shift registers over any finite field with [`FLFSR`](https://mhostetter.github.io/galois/latest/api/galois.FLFSR/) and [`GLFSR`](https://mhostetter.github.io/galois/latest/api/galois.GLFSR/).\n- Various [number theoretic functions](https://mhostetter.github.io/galois/latest/api/#number-theory).\n- [Integer factorization](https://mhostetter.github.io/galois/latest/api/#factorization) and accompanying algorithms.\n- [Prime number generation](https://mhostetter.github.io/galois/latest/api/#prime-number-generation) and [primality testing](https://mhostetter.github.io/galois/latest/api/#primality-tests).\n\n## Roadmap\n\n- Elliptic curves over finite fields\n- Galois ring arrays\n- GPU support\n\n## Documentation\n\nThe documentation for `galois` is located at https://mhostetter.github.io/galois/latest/.\n\n## Getting Started\n\nThe [Getting Started](https://mhostetter.github.io/galois/latest/getting-started/) guide is intended to assist the user with installing the\nlibrary, creating two example arrays, and performing basic array arithmetic. See [Basic Usage](https://mhostetter.github.io/galois/latest/basic-usage/array-classes/)\nfor more detailed discussions and examples.\n\n### Install the package\n\nThe latest version of `galois` can be installed from [PyPI](https://pypi.org/project/galois/) using `pip`.\n\n```console\n$ python3 -m pip install galois\n```\n\nImport the `galois` package in Python.\n\n```python\nIn [1]: import galois\n\nIn [2]: galois.__version__\nOut[2]: '0.4.2'\n```\n\n### Create a [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/) subclass\n\nNext, create a [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/) subclass\nfor the specific finite field you'd like to work in. This is created using the `galois.GF()` class factory. In this example, we are\nworking in $\\mathrm{GF}(3^5)$.\n\n```python\nIn [3]: GF = galois.GF(3**5)\n\nIn [4]: print(GF.properties)\nGalois Field:\n  name: GF(3^5)\n  characteristic: 3\n  degree: 5\n  order: 243\n  irreducible_poly: x^5 + 2x + 1\n  is_primitive_poly: True\n  primitive_element: x\n```\n\nThe [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/) subclass `GF` is a subclass of\n`np.ndarray` that performs all arithmetic in the Galois field $\\mathrm{GF}(3^5)$, not in $\\mathbb{R}$.\n\n```python\nIn [5]: issubclass(GF, galois.FieldArray)\nOut[5]: True\n\nIn [6]: issubclass(GF, np.ndarray)\nOut[6]: True\n```\n\nSee [Array Classes](https://mhostetter.github.io/galois/latest/basic-usage/array-classes/) for more details.\n\n### Create two [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/) instances\n\nNext, create a new [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/) `x` by passing an\n[`ArrayLike`](https://mhostetter.github.io/galois/latest/api/galois.typing.ArrayLike/) object to `GF`'s constructor.\n\n```python\nIn [7]: x = GF([236, 87, 38, 112]); x\nOut[7]: GF([236,  87,  38, 112], order=3^5)\n```\n\nThe array `x` is an instance of [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/) and also\nan instance of `np.ndarray`.\n\n```python\nIn [8]: isinstance(x, galois.FieldArray)\nOut[8]: True\n\nIn [9]: isinstance(x, np.ndarray)\nOut[9]: True\n```\n\nCreate a second [`FieldArray`](https://mhostetter.github.io/galois/latest/api/galois.FieldArray/) `y` by converting an existing\nNumPy array (without copying it) by invoking `.view()`. When finished working in the finite field, view it back as a NumPy array\nwith `.view(np.ndarray)`.\n\n```python\n# y represents an array created elsewhere in the code\nIn [10]: y = np.array([109, 17, 108, 224]); y\nOut[10]: array([109,  17, 108, 224])\n\nIn [11]: y = y.view(GF); y\nOut[11]: GF([109,  17, 108, 224], order=3^5)\n```\n\nSee [Array Creation](https://mhostetter.github.io/galois/latest/basic-usage/array-creation/) for more details.\n\n### Change the element representation\n\nThe representation of finite field elements can be set to either the integer (`\"int\"`), polynomial (`\"poly\"`),\nor power (`\"power\"`) representation. The default representation is the integer representation since integers are natural when\nworking with integer NumPy arrays.\n\nSet the element representation by passing the `repr` keyword argument to `galois.GF()` or by calling the `repr()`\nclassmethod. Choose whichever element representation is most convenient.\n\n```python\n# The default is the integer representation\nIn [12]: x\nOut[12]: GF([236,  87,  38, 112], order=3^5)\n\nIn [13]: GF.repr(\"poly\"); x\nOut[13]:\nGF([2\u03b1^4 + 2\u03b1^3 + 2\u03b1^2 + 2,               \u03b1^4 + 2\u03b1,\n             \u03b1^3 + \u03b1^2 + 2,      \u03b1^4 + \u03b1^3 + \u03b1 + 1], order=3^5)\n\nIn [14]: GF.repr(\"power\"); x\nOut[14]: GF([\u03b1^204,  \u03b1^16, \u03b1^230,  \u03b1^34], order=3^5)\n\n# Reset to the integer representation\nIn [15]: GF.repr(\"int\");\n```\n\nSee [Element Representation](https://mhostetter.github.io/galois/latest/basic-usage/element-representation/) for more details.\n\n### Perform array arithmetic\n\nOnce you have two Galois field arrays, nearly any arithmetic operation can be performed using normal NumPy arithmetic.\nThe traditional [NumPy broadcasting rules](https://numpy.org/doc/stable/user/basics.broadcasting.html) apply.\n\nStandard element-wise array arithmetic -- addition, subtraction, multiplication, and division -- are easily preformed.\n\n```python\nIn [16]: x + y\nOut[16]: GF([ 18,  95, 146,   0], order=3^5)\n\nIn [17]: x - y\nOut[17]: GF([127, 100, 173, 224], order=3^5)\n\nIn [18]: x * y\nOut[18]: GF([ 21, 241, 179,  82], order=3^5)\n\nIn [19]: x / y\nOut[19]: GF([ 67,  47, 192,   2], order=3^5)\n```\n\nMore complicated arithmetic, like square root and logarithm base $\\alpha$, are also supported.\n\n```python\nIn [20]: np.sqrt(x)\nOut[20]: GF([ 51, 135,  40,  16], order=3^5)\n\nIn [21]: np.log(x)\nOut[21]: array([204,  16, 230,  34])\n```\n\nSee [Array Arithmetic](https://mhostetter.github.io/galois/latest/basic-usage/array-arithmetic/) for more details.\n\n## Acknowledgements\n\nThe `galois` library is an extension of, and completely dependent on, [NumPy](https://numpy.org/). It also heavily\nrelies on [Numba](https://numba.pydata.org/) and the [LLVM just-in-time compiler](https://llvm.org/) for optimizing performance\nof the finite field arithmetic.\n\n[Frank Luebeck's compilation](http://www.math.rwth-aachen.de/~Frank.Luebeck/data/ConwayPol/index.html) of Conway polynomials and\n[Wolfram's compilation](https://datarepository.wolframcloud.com/resources/Primitive-Polynomials/) of primitive polynomials are used\nfor efficient polynomial lookup, when possible.\n\n[The Cunningham Book's tables](https://homes.cerias.purdue.edu/~ssw/cun/third/index.html) of prime factorizations, $b^n \\pm 1$\nfor $b \\in \\{2, 3, 5, 6, 7, 10, 11, 12\\}$, are used to generate factorization lookup tables. These lookup tables speed-up the\ncreation of large finite fields by avoiding the need to factor large integers.\n\n[Sage](https://www.sagemath.org/) is used extensively for generating test vectors for finite field arithmetic and polynomial arithmetic.\n[SymPy](https://www.sympy.org/en/index.html) is used to generate some test vectors. [Octave](https://www.gnu.org/software/octave/index)\nis used to generate test vectors for forward error correction codes.\n\nThis library would not be possible without all of the other libraries mentioned. Thank you to all their developers!\n\n## Citation\n\nIf this library was useful to you in your research, please cite us. Following the [GitHub citation standards](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files), here is the recommended citation.\n\n### BibTeX\n\n```bibtex\n@software{Hostetter_Galois_2020,\n    title = {{Galois: A performant NumPy extension for Galois fields}},\n    author = {Hostetter, Matt},\n    month = {11},\n    year = {2020},\n    url = {https://github.com/mhostetter/galois},\n}\n```\n\n### APA\n\n```\nHostetter, M. (2020). Galois: A performant NumPy extension for Galois fields [Computer software]. https://github.com/mhostetter/galois\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A performant NumPy extension for Galois fields and their applications",
    "version": "0.4.2",
    "project_urls": {
        "Changelog": "https://mhostetter.github.io/galois/latest/release-notes/versioning/",
        "Discuss": "https://github.com/mhostetter/galois/discussions",
        "Documentation": "https://mhostetter.github.io/galois/latest/",
        "Homepage": "https://github.com/mhostetter/galois",
        "Issues": "https://github.com/mhostetter/galois/issues",
        "Source": "https://github.com/mhostetter/galois",
        "Twitter": "https://twitter.com/galois_py"
    },
    "split_keywords": [
        "aes",
        " bch",
        " cryptography",
        " ecc",
        " elliptic curve cryptography",
        " elliptic curves",
        " encryption",
        " error correction",
        " fec",
        " finite field",
        " galois field",
        " golay",
        " hamming",
        " numpy",
        " reed solomon",
        " rsa"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f326e39f71818cae37d0098067a847869540fadccafb574a7f127dd56de38c50",
                "md5": "28d51faa2663dff4df796084fa2e38cf",
                "sha256": "f8fe38bd45c064ed28cb65df35ba4228010b8fa99e15b982e3aa3826b516d715"
            },
            "downloads": -1,
            "filename": "galois-0.4.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "28d51faa2663dff4df796084fa2e38cf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 4170494,
            "upload_time": "2024-09-06T00:03:36",
            "upload_time_iso_8601": "2024-09-06T00:03:36.136694Z",
            "url": "https://files.pythonhosted.org/packages/f3/26/e39f71818cae37d0098067a847869540fadccafb574a7f127dd56de38c50/galois-0.4.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fddd88d9001205f90c0cdd1d07771f3b61e789836863b49e9123dda16596778f",
                "md5": "e5c850ada4fea39bf9436a29ee28435c",
                "sha256": "bffdd595a29eefe7234075e508e685e328297b56b0279efa1d83dce2a68d92a7"
            },
            "downloads": -1,
            "filename": "galois-0.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "e5c850ada4fea39bf9436a29ee28435c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 7336612,
            "upload_time": "2024-09-06T00:03:38",
            "upload_time_iso_8601": "2024-09-06T00:03:38.461837Z",
            "url": "https://files.pythonhosted.org/packages/fd/dd/88d9001205f90c0cdd1d07771f3b61e789836863b49e9123dda16596778f/galois-0.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-06 00:03:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mhostetter",
    "github_project": "galois",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "galois"
}
        
Elapsed time: 0.35247s