generateConstants<F extends PastaFieldElement<F>> static method
MdsGenerateResult<F>
generateConstants<
F extends PastaFieldElement<F>>({ - required F fromBytes(
- List<int> bytes
),
- required F zero,
- required F one,
- int rate = 2,
- int width = 3,
- int fullRounds = 8,
- int partialRounds = 56,
- int secureMds = 0,
})
Implementation
static MdsGenerateResult<F>
generateConstants<F extends PastaFieldElement<F>>({
required F Function(List<int> bytes) fromBytes,
required F zero,
required F one,
int rate = 2,
int width = 3,
int fullRounds = 8,
int partialRounds = 56,
int secureMds = 0,
}) {
final sbox = SboxType.pow;
final Grain<F> grain = Grain<F>(
sbox: sbox,
t: width,
fromBytes: fromBytes,
rF: fullRounds,
rP: partialRounds,
);
final iter = fullRounds + partialRounds;
final roundConstants = List<List<F>>.generate(iter, (_) {
return List<F>.generate(width, (i) => grain.nextFieldElement());
});
final mds = generateMds<F>(grain, width, secureMds, one, zero);
return MdsGenerateResult(
mds: mds.mds,
mdsInv: mds.mdsInv,
constants: roundConstants,
);
}