// generate test cases for mod_L.c // // Usage: java gen_L [n] // // number of test cases (n) default is 10 // // Each test case consists of: // // w, w mod L // import java.math.BigInteger; import java.util.Random; public class gen_L { static BigInteger TWO = BigInteger.valueOf(2); static BigInteger TEN = BigInteger.valueOf(10); // curve group order L = 2^252 + 27742317777372353535851937790883648493 // static BigInteger L = BigInteger.ONE.shiftLeft(252).add( new BigInteger("27742317777372353535851937790883648493")); // print in hex // public static void print( BigInteger x) { String s = x.toString(16); int len = s.length(); while( len++ < 128) System.out.print( "0"); // leading 0's System.out.println( s); } public static void main( String args[]) { int n = 10; // number of test cases to generate if( args.length > 0) n = Integer.parseInt( args[0]); Random R = new Random(); BigInteger w; for( int i = 1; i <= n; ++i) { switch(i) { case 1: w = L; break; case 2: w = L.add(BigInteger.ONE); break; case 3: w = L.subtract(BigInteger.ONE); break; case 4: w = L.add(TWO); break; case 5: w = L.multiply(TEN).add(TEN); break; case 6: w = BigInteger.ONE.shiftLeft(512).subtract(BigInteger.ONE); break; default: w = new BigInteger( 512, R); break; } print(w); print(w.mod(L)); } } }