private GF256Poly BuildGenerator(int degree)
{
if (degree >= cachedGenerators.Count)
{
var lastGenerator = cachedGenerators[cachedGenerators.Count - 1];
for (var d = cachedGenerators.Count; d <= degree; d++)
{
var nextGenerator = lastGenerator.Multiply(new GF256Poly(field, new int[] { 1, field.Exp(d - 1) }));
cachedGenerators.Add(nextGenerator);
lastGenerator = nextGenerator;
}
}
return(cachedGenerators[degree]);
}