Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bigint + bigint-based primitives #184

Open
14 tasks
mrdaybird opened this issue Jan 18, 2025 · 4 comments
Open
14 tasks

feat: bigint + bigint-based primitives #184

mrdaybird opened this issue Jan 18, 2025 · 4 comments
Assignees
Labels
dependencies 📦 Dependency updates and maintenance feature ✨ New feature or request priority-high 🔥 High priority tasks tech debt 🏗️ Technical debt and cleanup tasks

Comments

@mrdaybird
Copy link
Contributor

Some algorithms require fields over huge numbers, and primitives defined over these large fields.
For example, the Ed25519 digital signature algorithm uses a curve over the prime field defined by prime number $2^{255} - 19$.
So, we need a way to represent large numbers and add support for it within primitives in ronkathon.

  • BigInt: Represent arbitrarily large number, say >128-bit.

The structs and traits that should support BigInt:

  • field module:
    • Finite
    • FiniteField
    • PrimeField
    • GaloisField
    • BinaryTowers
  • group module:
    • FiniteGroup
    • MultiplicativePrimeGroup
  • curve module:
    • EllipticCurve
    • AffinePoint
    • EdwardsCurve

Unresolved Questions:

  1. Should these bigint-based primitives replace the existing ones or live separately in another module?
  2. Are there other structs/traits that should be added to the above list?
@mrdaybird
Copy link
Contributor Author

I am working on BigInt and PrimeField at the moment.

@Autoparallel
Copy link
Contributor

Autoparallel commented Jan 18, 2025

@mrdaybird thoughts on:

  • removing PrimeField as GaloisField<P,1> for prime P accomplishes the same thing?
  • Renaming FiniteGroup to Group
  • Removing Finite altogether?
  • Removing MultiplicativeFiniteGroup?

I feel that we could simplify things here quite a bit. These may be unrelated to your issue as created, but perhaps it would be better to simplify prior to implementing bigint on more items?

@Autoparallel Autoparallel added priority-high 🔥 High priority tasks dependencies 📦 Dependency updates and maintenance tech debt 🏗️ Technical debt and cleanup tasks feature ✨ New feature or request labels Jan 18, 2025
@mrdaybird
Copy link
Contributor Author

mrdaybird commented Jan 18, 2025

removing PrimeField as GaloisField<P,1> for prime P accomplishes the same thing?

You meanGaloisField<1, P>? But doesn't GaloisField use PrimeField itself?

pub struct GaloisField<const N: usize, const P: usize> {
  pub(crate) coeffs: [PrimeField<P>; N],
}

Also, one practical difference between a PrimeField and field over any non-prime number is that inverse in PrimeField can be calculated as $x^{P-2}$ otherwise we have to use the extended euclidean algorithm or some exotic inverter like safegcd

Same thing with MultiplicativePrimeGroup, it has nice inversion properties, maybe we could leave it there.

Removing finite stuff should be a good idea because computationally everything is finite.

Also, what are your thoughts on this?

Should these bigint-based primitives replace the existing ones or live separately in another module?

@mrdaybird
Copy link
Contributor Author

@lonerapier I will appreciate your thoughts and suggestions on this as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies 📦 Dependency updates and maintenance feature ✨ New feature or request priority-high 🔥 High priority tasks tech debt 🏗️ Technical debt and cleanup tasks
Projects
None yet
Development

No branches or pull requests

2 participants