home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / HPACK78S.ZIP / crypt / mdc.h < prev    next >
C/C++ Source or Header  |  1992-10-13  |  2KB  |  57 lines

  1. /****************************************************************************
  2. *                                                                            *
  3. *                            HPACK Multi-System Archiver                        *
  4. *                            ===========================                        *
  5. *                                                                            *
  6. *                          MDC Message Digest Cipher Header                    *
  7. *                              MDC.C  Updated 12/08/92                        *
  8. *                                                                            *
  9. * This program is protected by copyright and as such any use or copying of    *
  10. *  this code for your own purposes directly or indirectly is highly uncool    *
  11. *                      and if you do so there will be....trubble.                *
  12. *                 And remember: We know where your kids go to school.            *
  13. *                                                                            *
  14. *            Copyright 1992  Peter C.Gutmann.  All rights reserved            *
  15. *                                                                            *
  16. ****************************************************************************/
  17.  
  18. #ifdef __MAC__
  19.   #include "defs.h"
  20.   #include "md5.h"
  21. #else
  22.   #include "defs.h"
  23.   #include "crypt/md5.h"
  24. #endif /* __MAC__ */
  25.  
  26. /* The block size (in bytes) */
  27.  
  28. #define BLOCKSIZE    16
  29.  
  30. /* The default IV value used to seed the cipher in initKey().  Changing this
  31.    for each file precludes the use of precomputed encrypted data for very
  32.    fast checking against known plaintext */
  33.  
  34. #define DEFAULT_IV        ( ( BYTE * ) "\0\0\0\0\0\0\0\0" )
  35.  
  36. #define IV_SIZE            8
  37.  
  38. /* Define for simple block encryption */
  39.  
  40. void MD5Transform( LONG *digest, LONG *data );
  41. void longReverse( LONG *buffer, int byteCount );
  42.  
  43. #ifdef LITTLE_ENDIAN
  44.   #define mdcTransform(iv)    longReverse( ( LONG * ) iv, BLOCKSIZE ); \
  45.                             MD5Transform( ( LONG * ) iv, ( LONG * ) auxKey ); \
  46.                             longReverse( ( LONG * ) iv, BLOCKSIZE )
  47. #else
  48.   #define mdcTransform(iv)    MD5Transform( ( LONG * ) iv, ( LONG * ) auxKey )
  49. #endif /* LITTLE_ENDIAN */
  50.  
  51. /* Prototypes for functions in MDC.C */
  52.  
  53. void initKey( BYTE *key, int keyLength, const BYTE *iv );
  54. void encryptCFB( BYTE *buffer, int length );
  55. void decryptCFB( BYTE *buffer, int length );
  56. BYTE *getIV( void );
  57.