Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trivo25/istar
A composition of algebra finite fields, polynomials and elliptic curves.
https://github.com/trivo25/istar
Last synced: about 1 month ago
JSON representation
A composition of algebra finite fields, polynomials and elliptic curves.
- Host: GitHub
- URL: https://github.com/trivo25/istar
- Owner: Trivo25
- Created: 2023-05-07T20:33:24.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-14T21:01:53.000Z (over 1 year ago)
- Last Synced: 2023-10-15T20:50:37.596Z (over 1 year ago)
- Language: TypeScript
- Size: 3.8 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## istar
--
Istar is a collection of mathematical primitives such as finite fields or elliptic curves and cryptographic protocols.
### Finite Fields
```ts
// 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
```ts
// 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
```ts
// 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
```ts
// 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) {}
```