home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / crypl200.zip / BLOWFISH / BLOWFISH.H < prev   
Text File  |  1996-01-24  |  1KB  |  40 lines

  1. #ifndef _BLOWFISH_DEFINED
  2.  
  3. #define _BLOWFISH_DEFINED
  4.  
  5. /* Blowfish global constants */
  6.  
  7. #define BLOWFISH_BLOCKSIZE            8
  8.  
  9. /* Blowfish-SK default key setup iterations */
  10.  
  11. #define BLOWFISH_KEYSETUP_ITERATIONS    10
  12.  
  13. /* Blowfish constants */
  14.  
  15. #define BLOWFISH_SBOX_SIZE            256        /* Number of S-box entries */
  16. #define BLOWFISH_SBOX_SIZE_BYTES    ( BLOWFISH_SBOX_SIZE * 4 )
  17. #define BLOWFISH_PARRAY_SIZE        18        /* Number of P-array entries */
  18. #define BLOWFISH_PARRAY_SIZE_BYTES    ( BLOWFISH_PARRAY_SIZE * 4 )
  19. #define BLOWFISH_KEYSIZE_BYTES        ( ( BLOWFISH_SBOX_SIZE_BYTES * 4 ) + \
  20.                                         BLOWFISH_PARRAY_SIZE_BYTES )
  21.  
  22. /* A structure to hold the Blowfish key */
  23.  
  24. typedef struct {
  25.     LONG P[ BLOWFISH_PARRAY_SIZE ];            /* P-array */
  26.     LONG S1[ BLOWFISH_SBOX_SIZE ],
  27.          S2[ BLOWFISH_SBOX_SIZE ],
  28.          S3[ BLOWFISH_SBOX_SIZE ],
  29.          S4[ BLOWFISH_SBOX_SIZE ];            /* S-boxes */
  30.     } BLOWFISH_KEY;
  31.  
  32. /* Prototypes for functions in BLOWFISH.C */
  33.  
  34. void blowfishEncrypt( BLOWFISH_KEY *key, BYTE *data );
  35. void blowfishDecrypt( BLOWFISH_KEY *key, BYTE *data );
  36. int blowfishKeyInit( BLOWFISH_KEY *key, BYTE *userKey, int userKeyLength );
  37. int blowfishKeyInitSK( BLOWFISH_KEY *key, BYTE *userKey, int userKeyLength, int keySetupIterations );
  38.  
  39. #endif /* _BLOWFISH_DEFINED */
  40.