#include "xmail.h" #include "sys/types.h" #include "sys/dir.h" #include "ctype.h" #include "pwd.h" #include "sys/stat.h" char *myname; int uid; struct direct dbuf; char *maildir = "/usr/spool/secretmail/"; FILE *kf, *mf, *df; MINT *x, *b, *one, *t45, *z, *q, *r; MINT *two, *t15, *mbuf; char buf[256], line[128]; #define MXF 100 int fnum[MXF], fcnt; struct stat stbuf; main() { int i; char *p; uid = getuid(); myname = getlogin(); if(myname == NULL) myname = getpwuid(uid)->pw_name; comminit(); mbuf = itom(0); files(); setup(getpass("Key: ")); mkb(); mkx(); #ifndef debug invert(x, b, x); #else invert(x, b, z); mult(x, z, z); mdiv(z, b, q, z); omout(z); invert(x, b, x); #endif for(i=0; i= MXF) break; fnum[fcnt++] = i; } if(fcnt == 0) { printf("no secret mail\n"); exit(0); } qsort(fnum, fcnt, sizeof(int), icmp); } decipher(u, w) FILE *u, *w; { int i; short a; for(;;) { nin(mbuf, u); if(feof(u)) break; mult(mbuf, x, mbuf); mdiv(mbuf, b, q, mbuf); for(i=1; i<=3; i++) { a = mbuf->val[i]; putc(a&0177, w); a >>= 8; putc(a&0177, w); } } }