Skip to content

Instantly share code, notes, and snippets.

View rot256's full-sized avatar

Mathias Hall-Andersen rot256

View GitHub Profile
@rot256
rot256 / gen-ff.sage
Created November 4, 2022 20:55
Sage script to generate an ark_ff field implementation
import sys
LIMB = 64
mod = int(sys.argv[1]) if len(sys.argv) > 1 else 28948022309329048855892746252171976963363056481941560715954676764349967630337
name = sys.argv[2] if len(sys.argv) > 2 else 'Fp'
bits = int(mod).bit_length()
limbs = (bits + LIMB - 1) // LIMB
size = limbs * LIMB