xref: /inferno-os/appl/lib/ida/mktab.b (revision 37da2899f40661e3e9631e497da8dc59b971cbd0)
1implement Genfield;
2
3include "sys.m";
4	sys: Sys;
5
6include "draw.m";
7
8include "keyring.m";
9	kr: Keyring;
10	IPint: import kr;
11
12Genfield: module
13{
14	init:	fn(nil: ref Draw->Context, nil: list of string);
15};
16
17Field: con 65537;
18
19init(nil: ref Draw->Context, args: list of string)
20{
21	sys = load Sys Sys->PATH;
22	kr = load Keyring Keyring->PATH;
23
24	f := IPint.inttoip(Field);
25	fm2 := f.sub(IPint.inttoip(2));
26	for(i := 1; i <= Field; i++){
27		x := IPint.inttoip(i);
28		y := x.expmod(fm2, f);
29#		sys->print("%s\n", x.mul(y).expmod(IPint.inttoip(1), f).iptostr(10));
30		sys->print("%d,\n", y.iptoint());
31	}
32}
33