/* ** Copyright 1998 - 2006 Double Precision, Inc. ** See COPYING for distribution information. */ #if HAVE_CONFIG_H #include "config.h" #endif #if HAVE_UNISTD_H #include #endif #if HAVE_FCNTL_H #include #endif #include #include #include #include #include #include #define MD5_INTERNAL #include "md5/md5.h" #include "random128.h" const char *random128() { static char randombuf[sizeof(MD5_DIGEST)*2+1]; #ifdef RANDOM { int fd=open(RANDOM, O_RDONLY); char buf2[sizeof(MD5_DIGEST)]; int i; if (fd >= 0) { if (read(fd, buf2, sizeof(buf2)) == sizeof(buf2)) { for (i=0; i= 0) ; #endif execl(PS, PS, PS_OPTIONS, (char *)0); perror(PS); _exit(0); } close(pipefd[1]); md5_context_init(&context); md5_context_hashstream(&context, &t, sizeof(t)); md5_context_hashstream(&context, &p, sizeof(p)); l=sizeof(t)+sizeof(p); while ((n=read(pipefd[0], buf, sizeof(buf))) > 0) { md5_context_hashstream(&context, buf, n); l += n; } md5_context_endstream(&context, l); md5_context_digest(&context, digest); close(pipefd[0]); while ((p2=wait(&s)) >= 0 && p != p2) ; for (n=0; n