public static void PrimeFinder() { GaloisField256 field; for( int size = 2; size <= 256; size++ ) { for( int primeElement = 2; primeElement <= 512; primeElement++ ) { field = new GaloisField256( size, primeElement ); if( VerifyField( field ) ) { Console.Out.WriteLine( "Found - size: {0}; prime: {1}", size, primeElement ); } } } }
public static bool VerifyField( GaloisField256 field ) { HashSet<int> values = new HashSet<int>(); for( int i = 0; i < field.Field.Length; i++ ) { if( values.Contains( field.Field[i] ) ) { return false; } values.Add( field.Field[i] ); } for( int i = 0; i < field.Field.Length; i++ ) { if( values.Contains( i ) == false ) { return false; } } return true; }