gf2lib is a library for manipulating GF (2) polynomials and GF (2) matrices over finite fields
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gf2lib-0.0.1.tar.gz.
File metadata
- Download URL: gf2lib-0.0.1.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f017c74fb48ad5539488d341f3175d9cbb81ef9a4e07ea9b3571ddd800532ccd
|
|
| MD5 |
88809d3bc1c82e84b2ee60c9fba241e4
|
|
| BLAKE2b-256 |
c0807803b24449e1dd2c5eed96b3952a5a715cceb6e59892c9c7b666b9bbfacf
|
File details
Details for the file gf2lib-0.0.1-py3-none-any.whl.
File metadata
- Download URL: gf2lib-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e2d650eca64c8add849efe23d4162e9eec3aeea9c18d099ea89978a8e4cbd74
|
|
| MD5 |
e574e4b17c081094b11d09f57700786a
|
|
| BLAKE2b-256 |
3edab6ce2d53f200ff6cf4346cb28ffa4f928e3110ce428b53605eee23e6765d
|