Annotation of pgp/src/random.h, revision 1.1.1.1

1.1       root        1: /*     random.h - Header include file for random.c
                      2:        Last revised 15 Dec 90
                      3:        (c) 1989 Philip Zimmermann.  All rights reserved.
                      4: */
                      5: 
                      6: 
                      7: /* Elaborate protection mechanisms to assure no redefinitions of types...*/
                      8: #ifndef BOOLSTUFF
                      9: #define BOOLSTUFF
                     10: #ifndef TRUE
                     11: #define FALSE 0
                     12: #define TRUE (!FALSE)
                     13: #endif /* if TRUE not already defined */
                     14: typedef unsigned char boolean; /* values are TRUE or FALSE */
                     15: #endif /* if BOOLSTUFF not already defined */
                     16: #ifndef BYTESTUFF
                     17: #define BYTESTUFF
                     18: typedef unsigned char byte;    /* values are 0-255 */
                     19: typedef byte *byteptr; /* pointer to byte */
                     20: typedef char *string;  /* pointer to ASCII character string */
                     21: #endif /* if BYTESTUFF not already defined */
                     22: #ifndef min    /* if min macro not already defined */
                     23: #define min(a,b) ( (a)<(b) ? (a) : (b) )
                     24: #define max(a,b) ( (a)>(b) ? (a) : (b) )
                     25: #endif /* if min macro not already defined */
                     26: 
                     27: 
                     28: int pseudorand(void);  /* 16-bit LCG pseudorandom generator */
                     29: 
                     30: /* Don't define PSEUDORANDOM unless you want only pseudorandom numbers */
                     31: 
                     32: #ifdef PSEUDORANDOM            /* use pseudorandom numbers */
                     33: #define randombyte()  ((byte) pseudorand())    /* pseudorandom generator */
                     34: #define randaccum(bitcount)            /* null function */
                     35: #define randload(bitcount)     /* null function */
                     36: #define randflush()            /* null function */
                     37: #define capturecounter()       /* null function */
                     38: #define keypress() kbhit()     /* TRUE iff keyboard input ready */
                     39: #define getkey() getch()       /* returns data from keyboard (no echo). */
                     40: #endif /* ifdef PSEUDORANDOM */
                     41: 
                     42: #ifndef PSEUDORANDOM           /* use truly random numbers */
                     43: 
                     44: extern int randcount;  /* number of random bytes accumulated in pool */
                     45: 
                     46: void capturecounter(void); /* capture a fast counter into the random pool. */
                     47: /* Should be called when the user clicks the mouse, or from getkey(). */
                     48: 
                     49: short randombyte(void);        /* returns truly random byte from pool */
                     50: 
                     51: int getstring(char *strbuf,int maxlen,boolean echo);
                     52: 
                     53: void randaccum(short bitcount);        /* get this many raw random bits ready */
                     54: 
                     55: short randload(short bitcount);
                     56: /* Get fresh load of raw random bits into recyclepool for key generation */
                     57: 
                     58: void randflush(void);  /* flush recycled random bytes */
                     59: 
                     60: boolean keypress(void);        /* TRUE iff keyboard input ready */
                     61: short getkey(void);            /* returns data from keyboard (no echo). */
                     62: 
                     63: #endif                 /* ifndef PSEUDORANDOM */
                     64: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.