Skip to main content

gf2lib

gf2lib是一个操作有限域GF(2)多项式和GF(2)矩阵的库

  • gf2lib.gf2poly:GF(2)多项式
  • gf2lib.gf2matrix:GF(2)矩阵

一、 快速开始

  • (1) 通过pip安装
pip install gf2lib
  • (2)直接拷贝位于src中的源代码

二、 demo

更多参考样例见GitHub中的example文件夹,gf2lib

  • (1) gf2poly
from gf2lib.gf2poly import GF2Poly

ir_poly = 0x11b  # p(x)=x^8+x^4+x^3+x+1

a = GF2Poly(0b101, ir_poly)  # x^2+1
b = GF2Poly(0b010, ir_poly)  # x

print(a.value)  # 0b101
print(a.ir_poly)  # 0b100011011
print(a)  # 0b101

c = a + b  # 加法
d = a * b  # 乘法
e = a ** 4  # 幂
f = a / b  # 除法
g = a % b  # 模
h = a.inverse()  # 求逆
  • (2) gf2matrix
from gf2lib.gf2matrix import GF2Matrix

M = GF2Matrix([[0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1], [1, 0, 0, 0]])
M = M * M  # 乘法
M = M.inverse()  # 求逆
print(M)  # [[0, 0, 1, 0], [0, 0, 0, 1], [1, 0, 0, 0], [0, 1, 0, 0]]

gf2lib

gf2lib is a library for manipulating GF (2) polynomials and GF (2) matrices over finite fields

  • gf2lib.gf2poly: GF (2) polynomial
  • gf2lib.gf2matrix: GF (2) matrix

1. Quick Start

  • (1) Install via pip
pip install gf2lib
  • (2) Directly copy the source code in src

2. Demo

For more reference examples, see the example folder in GitHub. gf2lib

Release files for gf2lib 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gf2lib 0.0.1
File Size Uploaded
gf2lib-0.0.1.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gf2lib 0.0.1
File Interpreter ABI Platform
gf2lib-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.9 kB

Release files / gf2lib-0.0.1.tar.gz

Download URL gf2lib-0.0.1.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f017c74fb48ad5539488d341f3175d9cbb81ef9a4e07ea9b3571ddd800532ccd
BLAKE2b-256 checksum
How to use checksums
c0807803b24449e1dd2c5eed96b3952a5a715cceb6e59892c9c7b666b9bbfacf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.5

Release files / gf2lib-0.0.1-py3-none-any.whl

Download URL gf2lib-0.0.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e2d650eca64c8add849efe23d4162e9eec3aeea9c18d099ea89978a8e4cbd74
BLAKE2b-256 checksum
How to use checksums
3edab6ce2d53f200ff6cf4346cb28ffa4f928e3110ce428b53605eee23e6765d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.5

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page