Skip to content

Implement serialization and deserialization for fields and curve points #8

@mpenciak

Description

@mpenciak

We should implement serialization and serialization for field elements, and curve points.

SerDe should target the built-in ByteArray data type, and we can just use the binary expension of field elements to as their serialization.

Curve points should be serialized by their constituent field elements, and also an additional UInt8 tag at the beginning containing data such as:

  • The form of this point (projective or affine)
  • Compressed or uncompressed (see below)

We should also have a "compressed" serialization where we serialize only the x-coordinate, and use one of the bits in the UInt8 tag to signal whether we take the positive or negative root of x^3 + ax + b.

As part of this issue we should take the time to re-structure our field typeclasses.

The image I have for this is that:

  • Field is the base class encoding all the arithmetic operations of fields
  • NewField (possibly rename to PrimeField?) is the class for efficient field implementations
  • GaloisField is the class for field extensions, and has all of the operations related to the Frobenius
  • PrimeField (rename to something else) is the class that adds additional serialization/deserialization methods on anything that implements Field (in particular, this should apply to both NewField and GaloisField

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions