Trivo25 / istar

A composition of algebra finite fields, polynomials and elliptic curves.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

istar

--

Istar is a collection of mathematical primitives such as finite fields or elliptic curves and cryptographic protocols.

Finite Fields

// Create a new finite field class with modulus p = 251
class F_251 extends createField(251n) {}

// initiate a finite field element

let a = F_251.from(5n);

a.add(5n).toBigint() === 10n; // true

a.add(251n).toBigint() === 5n; // true

Polynomials over Finite Fields

// Create a new finite field class with modulus p = 251
class F_251 extends createField(251n) {}
// Create a new polynomial class based on F_251
class P_251 extends createPolynomial(F_251) {}

// initiate a polynomial

let p = P_251.from([F_251.from(12n), F_251.from(2n), F_251.from(1n)]);

Elliptic Curves over Finite Fields

// Create a new finite field class with modulus p = 251
class F_251 extends createField(251n) {}
// Create a new elliptic curve class over a finite field
class G extends createEllipticCurveGroup(F_251, {
  a: 0n,
  b: 3n,
  g: { x: 1n, y: 2n },
}) {}

Extension fields

// Create a new finite field class with modulus p = 251
class F_251 extends createField(251n) {}
// Extend the field
let ir = P.from([F.from(2n), F.from(0n), F.from(1n)]);

class Fk extends extend(F, ir.coefficients, 2n) {}

About

A composition of algebra finite fields, polynomials and elliptic curves.


Languages

Language:TypeScript 98.7%Language:JavaScript 1.3%