home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / crypl200.zip / RC / RC4.H < prev    next >
Text File  |  1995-07-09  |  636b  |  24 lines

  1. #include <limits.h>
  2.  
  3. /* If the system can handle byte ops, we use those so we don't have to do a
  4.    lot of masking.  Otherwise, we use machine-word-size ops which will be
  5.    faster on RISC machines */
  6.  
  7. #if UINT_MAX > 0xFFFFL        /* System has 32-bit ints */
  8.   #define USE_LONG_RC4
  9.  
  10.   typedef unsigned int rc4word;
  11. #else
  12.   typedef unsigned char rc4word;
  13. #endif /* UINT_MAX > 0xFFFFL */
  14.  
  15. /* The scheduled RC4 key */
  16.  
  17. typedef struct {
  18.     rc4word state[ 256 ];
  19.     rc4word x, y;
  20.     } RC4KEY ;
  21.  
  22. void rc4ExpandKey( RC4KEY *rc4, unsigned char const *key, int keylen );
  23. void rc4Crypt( RC4KEY *rc4, unsigned char *data, int len );
  24.