Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Adding Features of getting a primitive element in GF(q).

Latest
Compare
Choose a tag to compare
@syakoo syakoo released this 03 Dec 03:40
· 21 commits to master since this release
27bec63

Motivation

This library was created to apply Finite Field to cryptography and coding theory, Especially in cryptography, there are many situations where we want to get a primitive element in GF(q). So we implemented a function to get a primitive element for all GF(q).

Usage

It can be retrieved by executing random_primitive_elm() function of the GFp or GFpn class.

gf_11 = GFp(11)
# Getting a random primitive element in GF(11)
gf_11.random_primitive_elm() # 8 (mod 11)

gf_5_4 = GFpn(5, [1, 0, 0, 0, 2])
# Getting a random primitive element in GF(5^4)
gf_5_4.random_primitive_elm() # 1x^3 + 2x^2 + 4x + 3

Be careful when using a finite field with large orders because the computational complexity is very large.