home *** CD-ROM | disk | FTP | other *** search
- /* ecmfeed.m
- Feeder source example for elliptic curve method (ECM).
- Compile with:
-
- > cc -O ecmfeed.m Feeder.o -s -o ecm.feed
-
- Then the executable ecm.feed assumes, at run time, the existence
- of the actual ecm program "ecm."
-
- Copyright 1991 NeXT, Inc. All Rights Reserved.
- */
-
- #include <stdio.h>
- #include <libc.h>
- #include "Feeder.h"
-
- void set_random_seed()
- /* Start the random number generator at a new position. */
- {
- struct timeval tp;
-
- gettimeofday(&tp,NULL);
- srandom((int)tp.tv_usec + (int)getpid());
- }
-
-
- void main(int argc, char **argv)
- {
- id feed = [Feeder new];
- int n,seed,sgn,q;
- char cmd[256],host[16];
- char letter[8];
- int *hi;
-
- set_random_seed();
- n = [feed numMachines];
- while(n--) {
- if(![feed isLaunchable:n]) continue;
- [feed getHostname:host for:n];
- hi = (int *) (&host[0]);
- seed = random() ^ (*hi); /* Every machine gets a random seed. */
- sgn = 1;
- q = 128; /* We are going to try to factor F7 = 2^(2^7) + 1. */
- if(sgn<0) strcpy(letter,"m"); else strcpy(letter,"f");
- sprintf(cmd, "cd ~/Zfactor; ecm %d %d %d 10000 0 24 > log.%s%d.%s",sgn,q,seed,letter,q,host);
- [feed changeHost:n user:NULL password:NULL command:cmd];
- }
- [feed launchAll];
- }
-