#define _XOPEN_SOURCE #include #include #include #include #include #define LEN 10 int main(int argc, char *argv[]) { char target[] = ".............."; char buf[LEN+1]; int i, n=0; char *hash; int difficulty = 3; if (argc != 3) { fprintf(stderr, "usage: %s DIFFICULTY PREFIX\n", *argv); return 1; } difficulty = atoi(argv[1]); if (difficulty > strlen(target)-1) { difficulty = strlen(target)-1; } if (difficulty < 0) { difficulty = 0; } target[difficulty] = 'z'; srand(getpid()); while (n++ < 100) { buf[0] = *argv[2]; for (i=1; i