/* $Id: diCryptoSys.h $ */

/*  For `CryptoSys API` Version 4.5 and above.
    Requires `diCryptoSys.lib` and `diCryptoSys.dll` for Win32/X64
    or `diCryptoSys.a` for Linux.
*/

/* Copyright (C) 2001-11 DI Management Services Pty Limited. 
   All rights reserved. <www.di-mgt.com.au> <www.cryptosys.net>

   Last updated:
   $Date: 2011-01-19 21:52:00 $
   $Revision: 4.5.0 $
*/

#ifndef DICRYPTOSYS_H_
#define DICRYPTOSYS_H_ 1

/*************/
/* CONSTANTS */
/*************/
#define ENCRYPT 1
#define DECRYPT 0
/* Maximum number of bytes in hash digest byte array */
#define API_MAX_HASH_BYTES 64
#define API_SHA1_BYTES     20
#define API_SHA224_BYTES   28
#define API_SHA256_BYTES   32
#define API_SHA384_BYTES   48
#define API_SHA512_BYTES   64
#define API_MD5_BYTES      16
#define API_MD2_BYTES      16
#define API_RMD160_BYTES   20   /* Added v4.2 */
/* Maximum number of hex characters in hash digest */
#define API_MAX_HASH_CHARS (2*API_MAX_HASH_BYTES)
#define API_SHA1_CHARS     (2*API_SHA1_BYTES)
#define API_SHA224_CHARS   (2*API_SHA224_BYTES)
#define API_SHA256_CHARS   (2*API_SHA256_BYTES)
#define API_SHA384_CHARS   (2*API_SHA384_BYTES)
#define API_SHA512_CHARS   (2*API_SHA512_BYTES)
#define API_MD5_CHARS      (2*API_MD5_BYTES)
#define API_MD2_CHARS      (2*API_MD2_BYTES)
#define API_RMD160_CHARS   (2*API_RMD160_BYTES)
/* Maximum lengths of HMAC, CMAC and GMAC */
#define API_MAX_HMAC_BYTES 64
#define API_MAX_CMAC_BYTES 16
#define API_MAX_GMAC_BYTES 16   /* Added v4.2 */
#define API_MAX_HMAC_CHARS (2*API_MAX_HMAC_BYTES)
#define API_MAX_CMAC_CHARS (2*API_MAX_CMAC_BYTES)
#define API_MAX_GMAC_CHARS (2*API_MAX_GMAC_BYTES)
/* Synonyms retained for backwards compatibility */
#define API_MAX_SHA1_BYTES 20
#define API_MAX_SHA2_BYTES 32
#define API_MAX_MD5_BYTES  16
#define API_MAX_SHA1_CHARS (2*API_MAX_SHA1_BYTES)
#define API_MAX_SHA2_CHARS (2*API_MAX_SHA2_BYTES)
#define API_MAX_MD5_CHARS  (2*API_MAX_MD5_BYTES)
/* Encryption block sizes in bytes */
#define API_BLK_DES_BYTES  8
#define API_BLK_TDEA_BYTES 8
#define API_BLK_BLF_BYTES  8
#define API_BLK_AES_BYTES  16
/* Key size in bytes */
#define API_KEYSIZE_TDEA_BYTES     24
#define API_KEYSIZE_AES_MAX_BYTES  32
/* Required size for RNG seed file */
#define API_RNG_SEED_BYTES 64

/***********/
/* OPTIONS */
/***********/
/* Options for HASH functions */
#define API_HASH_SHA1     0
#define API_HASH_MD5      1
#define API_HASH_MD2      2
#define API_HASH_SHA256   3
#define API_HASH_SHA384   4
#define API_HASH_SHA512   5
#define API_HASH_SHA224   6 /* Added v4.1 */
#define API_HASH_RMD160   7 /* Added v4.2 */
#define API_HASH_MODE_TEXT 0x10000L

/* Options for MAC functions */
#define API_CMAC_TDEA     0x100 /* ) synonyms */
#define API_CMAC_DESEDE   0x100 /* ) synonyms */
#define API_CMAC_AES128   0x101
#define API_CMAC_AES192   0x102
#define API_CMAC_AES256   0x103

/* Options for RNG functions */
#define API_RNG_STRENGTH_112        0x00L
#define API_RNG_STRENGTH_128        0x01L

/* Block cipher (BC) algorithm options */
#define API_BC_TDEA    0x10L    // )
#define API_BC_3DES    0x10L    // ) equiv. synonyms for Triple DES
#define API_BC_DESEDE3 0x10L    // )
#define API_BC_AES128  0x20L
#define API_BC_AES192  0x30L
#define API_BC_AES256  0x40L

/* Block cipher mode options */
#define API_MODE_ECB  0x000L
#define API_MODE_CBC  0x100L
#define API_MODE_OFB  0x200L
#define API_MODE_CFB  0x300L
#define API_MODE_CTR  0x400L

/* Cipher file options - added [v4.5] */
#define API_IV_PREFIX 0x1000
#define API_PAD_LEAVE 0x2000

/* General */
#define API_GEN_PLATFORM 0x40    

/*************/
/* FUNCTIONS */
/*************/
/* __stdcall convention required for Win32 DLL only */
#if defined(unix) || defined (linux) || defined(__linux)
#define _stdcall
#endif

#ifdef __cplusplus
extern "C" {
#endif

/* GENERAL FUNCTIONS */
long _stdcall API_Version(void);
long _stdcall API_ErrorLookup(char *szOutput, long nMaxChars, long nErrCode);
long _stdcall API_CompileTime(char *szOutput, long nMaxChars);
long _stdcall API_ModuleName(char *szOutput, long nMaxChars, long reserved);
long _stdcall API_PowerUpTests(long nOptions);
long _stdcall API_LicenceType(long nOptions);
long _stdcall API_ErrorCode(void); /* Improved in [v4.5] */

/* AES-128 PROTOTYPES */
long _stdcall AES128_Bytes(unsigned char *lpOutput, const unsigned char *lpInput, long nBytes, const unsigned char *lpKey, int fEncrypt);
long _stdcall AES128_BytesMode(unsigned char *lpOutput, const unsigned char *lpInput, long nBytes, const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV);
long _stdcall AES128_Hex(char *szOutput, const char *szInput, const char *szKey, int fEncrypt);
long _stdcall AES128_HexMode(char *szOutput, const char *szInput, const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall AES128_B64Mode(char *szOutput, const char *szInput, const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall AES128_File(const char *szFileOut, const char *szFileIn, const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV);
long _stdcall AES128_FileExt(const char *szFileOut, const char *szFileIn, const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV, long nOptions);
long _stdcall AES128_FileHex(const char *szFileOut, const char *szFileIn, const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall AES128_Init(const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV);
long _stdcall AES128_InitHex(const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall AES128_Update(long hContext, unsigned char *lpData, long nDataLen);
long _stdcall AES128_UpdateHex(long hContext, char *szHexData);
long _stdcall AES128_Final(long hContext);
long _stdcall AES128_InitError(void);

/* AES-192 PROTOTYPES */
long _stdcall AES192_Bytes(unsigned char *lpOutput, const unsigned char *lpInput, long nBytes, const unsigned char *lpKey, int fEncrypt);
long _stdcall AES192_BytesMode(unsigned char *lpOutput, const unsigned char *lpInput, long nBytes, const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV);
long _stdcall AES192_Hex(char *szOutput, const char *szInput, const char *szKey, int fEncrypt);
long _stdcall AES192_HexMode(char *szOutput, const char *szInput, const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall AES192_B64Mode(char *szOutput, const char *szInput, const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall AES192_File(const char *szFileOut, const char *szFileIn, const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV);
long _stdcall AES192_FileExt(const char *szFileOut, const char *szFileIn, const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV, long nOptions);
long _stdcall AES192_FileHex(const char *szFileOut, const char *szFileIn, const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall AES192_Init(const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV);
long _stdcall AES192_InitHex(const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall AES192_Update(long hContext, unsigned char *lpData, long nDataLen);
long _stdcall AES192_UpdateHex(long hContext, char *szHexData);
long _stdcall AES192_Final(long hContext);
long _stdcall AES192_InitError(void);

/* AES-256 PROTOTYPES */
long _stdcall AES256_Bytes(unsigned char *lpOutput, const unsigned char *lpInput, long nBytes, const unsigned char *lpKey, int fEncrypt); 
long _stdcall AES256_BytesMode(unsigned char *lpOutput, const unsigned char *lpInput, long nBytes, const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV);
long _stdcall AES256_Hex(char *szOutput, const char *szInput, const char *szKey, int fEncrypt);
long _stdcall AES256_HexMode(char *szOutput, const char *szInput, const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall AES256_B64Mode(char *szOutput, const char *szInput, const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall AES256_File(const char *szFileOut, const char *szFileIn, const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV);
long _stdcall AES256_FileExt(const char *szFileOut, const char *szFileIn, const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV, long nOptions);
long _stdcall AES256_FileHex(const char *szFileOut, const char *szFileIn, const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall AES256_Init(const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV);
long _stdcall AES256_InitHex(const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall AES256_Update(long hContext, unsigned char *lpData, long nDataLen);
long _stdcall AES256_UpdateHex(long hContext, char *szHexData);
long _stdcall AES256_Final(long hContext);
long _stdcall AES256_InitError(void);

/* BLOWFISH PROTOTYPES */
long _stdcall BLF_Bytes(unsigned char *lpOutput, const unsigned char *lpInput, long nBytes, const unsigned char *lpKey, long keyBytes, int fEncrypt);
long _stdcall BLF_BytesMode(unsigned char *lpOutput, const unsigned char *lpInput, long nBytes, const unsigned char *lpKey, long keyBytes, int fEncrypt, const char *szMode, const unsigned char *lpIV);
long _stdcall BLF_Hex(char *szOutput, const char *szInput, const char *szKey, int fEncrypt);
long _stdcall BLF_HexMode(char *szOutput, const char *szInput, const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall BLF_B64Mode(char *szOutput, const char *szInput, const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall BLF_File(const char *szFileOut, const char *szFileIn, const unsigned char *lpKey, long keyBytes, int fEncrypt, const char *szMode, const unsigned char *lpIV);
long _stdcall BLF_FileExt(const char *szFileOut, const char *szFileIn, const unsigned char *lpKey, long keyBytes, int fEncrypt, const char *szMode, const unsigned char *lpIV, long nOptions);
long _stdcall BLF_FileHex(const char *szFileOut, const char *szFileIn, const char *szKey, int fEncrypt, const char *szMode, const char *sHexIV);
long _stdcall BLF_Init(const unsigned char *lpKey, long keyBytes, int fEncrypt, const char *szMode, const unsigned char *lpIV);
long _stdcall BLF_InitHex(const char *szKey, int fEncrypt, const char *szMode, const char *sHexIV);
long _stdcall BLF_Update(long hContext, unsigned char *lpData, long nDataLen);
long _stdcall BLF_UpdateHex(long hContext, char *szHexData);
long _stdcall BLF_Final(long hContext);
long _stdcall BLF_InitError(void);

/* DES PROTOTYPES */
long _stdcall DES_Bytes(unsigned char *lpOutput, const unsigned char *lpInput, long nBytes, const unsigned char *lpKey, int fEncrypt);
long _stdcall DES_BytesMode(unsigned char *lpOutput, const unsigned char *lpInput, long nBytes, const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV);
long _stdcall DES_Hex(char *szOutput, const char *szInput, const char *szKey, int fEncrypt);
long _stdcall DES_HexMode(char *szOutput, const char *szInput, const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall DES_B64Mode(char *szOutput, const char *szInput, const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall DES_File(const char *szFileOut, const char *szFileIn, const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV);
long _stdcall DES_FileExt(const char *szFileOut, const char *szFileIn, const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV, long nOptions);
long _stdcall DES_FileHex(const char *szFileOut, const char *szFileIn, const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall DES_Init(const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV);
long _stdcall DES_InitHex(const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall DES_Update(long hContext, unsigned char *lpData, long nDataLen);
long _stdcall DES_UpdateHex(long hContext, char *szHexData);
long _stdcall DES_Final(long hContext);
long _stdcall DES_InitError(void);
long _stdcall DES_CheckKey(const unsigned char *lpKey, long nKeyLen);
long _stdcall DES_CheckKeyHex(const char *szHexKey);

/* TRIPLE DES PROTOTYPES */
long _stdcall TDEA_Bytes(unsigned char *lpOutput, const unsigned char *lpInput, long nBytes, const unsigned char *lpKey, int fEncrypt);
long _stdcall TDEA_BytesMode(unsigned char *lpOutput, const unsigned char *lpInput, long nBytes, const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV);
long _stdcall TDEA_Hex(char *szOutput, const char *szInput, const char *szKey, int fEncrypt);
long _stdcall TDEA_HexMode(char *szOutput, const char *szInput, const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall TDEA_B64Mode(char *szOutput, const char *szInput, const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall TDEA_File(const char *szFileOut, const char *szFileIn, const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV);
long _stdcall TDEA_FileExt(const char *szFileOut, const char *szFileIn, const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV, long nOptions);
long _stdcall TDEA_FileHex(const char *szFileOut, const char *szFileIn, const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall TDEA_Init(const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV);
long _stdcall TDEA_InitHex(const char *szKey, int fEncrypt, const char *szMode, const char *szIV);
long _stdcall TDEA_Update(long hContext, unsigned char *lpData, long nDataLen);
long _stdcall TDEA_UpdateHex(long hContext, char *szHexData);
long _stdcall TDEA_Final(long hContext);
long _stdcall TDEA_InitError(void);

/* KEY WRAP FUNCTIONS (new in v4.1) */
long _stdcall CIPHER_KeyWrap(unsigned char *lpOutput, long nOutBytes, const unsigned char *lpData, long nDataLen, const unsigned char *lpKEK, long nKekLen, long nOptions);
long _stdcall CIPHER_KeyUnwrap(unsigned char *lpOutput, long nOutBytes, const unsigned char *lpData, long nDataLen, const unsigned char *lpKEK, long nKekLen, long nOptions);

/* GCM AUTHENTICATED EN/DECRYPTION FUNCTIONS (new in v4.2) */
long _stdcall GCM_Encrypt(unsigned char *lpOutput, long nOutLen, unsigned char *lpTagOut, long nTagLen, const unsigned char *lpData, long nDataLen, const unsigned char *lpKey, long nKeyLen, const unsigned char *lpIV, long nIvLen, const unsigned char *lpAAD, long nAadLen, long nOptions);
long _stdcall GCM_Decrypt(unsigned char *lpOutput, long nOutLen, const unsigned char *lpData, long nDataLen, const unsigned char *lpKey, long nKeyLen, const unsigned char *lpIV, long nIvLen, const unsigned char *lpAAD, long nAadLen, const unsigned char *lpTag, long nTagLen, long nOptions);
long _stdcall GCM_InitKey(const unsigned char *lpKey, long nKeyLen, long nOptions);
long _stdcall GCM_NextEncrypt(long hContext, unsigned char *lpOutput, long nOutLen, unsigned char *lpTagOut, long nTagLen, const unsigned char *lpData, long nDataLen, const unsigned char *lpIV, long nIvLen, const unsigned char *lpAAD, long nAadLen);
long _stdcall GCM_NextDecrypt(long hContext, unsigned char *lpOutput, long nOutLen, const unsigned char *lpData, long nDataLen, const unsigned char *lpIV, long nIvLen, const unsigned char *lpAAD, long nAadLen, const unsigned char *lpTag, long nTagLen);
long _stdcall GCM_FinishKey(long hContext);

/* GENERIC MESSAGE DIGEST HASH FUNCTIONS */
long _stdcall HASH_Bytes(unsigned char *lpOutput, long nOutLen, const void *lpMessage, long nMsgLen, long nOptions);
long _stdcall HASH_File(unsigned char *lpOutput, long nOutLen, const char *szFileName, long nOptions);
long _stdcall HASH_HexFromBytes(char *szOutput, long nMaxChars, const void *lpMessage, long nMsgLen, long nOptions);
long _stdcall HASH_HexFromFile(char *szOutput, long nMaxChars, const char *szFileName, long nOptions);
long _stdcall HASH_HexFromHex(char *szOutput, long nMaxChars, const char *szMsgHex, long nOptions);

/* GENERIC MAC FUNCTIONS (HMAC and CMAC) */
long _stdcall MAC_Bytes(unsigned char *lpOutput, long nOutLen, const void *lpMessage, long nMsgLen, const void *lpKey, long nKeyLen, long nOptions);
long _stdcall MAC_HexFromBytes(char *szOutput, long nMaxChars, const void *lpMessage, long nMsgLen, const void *lpKey, long nKeyLen, long nOptions);
long _stdcall MAC_HexFromHex(char *szOutput, long nMaxChars, const char *szMsgHex, const char *szKeyHex, long nOptions);

/* SHA-1 PROTOTYPES */
long _stdcall SHA1_StringHexHash(char *szDigest, const char *szMessage);
long _stdcall SHA1_FileHexHash(char *szDigest, const char *szFileName, const char *szMode);
long _stdcall SHA1_BytesHexHash(char *szDigest, const unsigned char *lpData, long nDataLen);
long _stdcall SHA1_BytesHash(unsigned char *digest, const unsigned char *lpData, long nDataLen);
long _stdcall SHA1_Init(void);
long _stdcall SHA1_AddString(long hContext, const char *szMessage);
long _stdcall SHA1_AddBytes(long hContext, const unsigned char *lpData, long nDataLen);
long _stdcall SHA1_HexDigest(char *szDigest, long hContext);
long _stdcall SHA1_Reset(long hContext);
long _stdcall SHA1_Hmac(char *szDigest, const unsigned char *textBytes, long textLen, const unsigned char *lpKeyBytes, long keyLen);
long _stdcall SHA1_HmacHex(char *szDigest, const char *sHexText, const char *sHexKey);

/* SHA-256 PROTOTYPES */
long _stdcall SHA2_StringHexHash(char *szDigest, const char *szMessage);
long _stdcall SHA2_FileHexHash(char *szDigest, const char *szFileName, const char *szMode);
long _stdcall SHA2_BytesHexHash(char *szDigest, const unsigned char *lpData, long nDataLen);
long _stdcall SHA2_BytesHash(unsigned char *lpDigest, const unsigned char *lpData, long nDataLen);
long _stdcall SHA2_Init(void);
long _stdcall SHA2_AddString(long hContext, const char *szMessage);
long _stdcall SHA2_AddBytes(long hContext, const unsigned char *lpData, long nDataLen);
long _stdcall SHA2_HexDigest(char *szDigest, long hContext);
long _stdcall SHA2_Reset(long hContext);
long _stdcall SHA2_Hmac(char *szDigest, const unsigned char *textBytes, long textLen, const unsigned char *lpKeyBytes, long keyLen);
long _stdcall SHA2_HmacHex(char *szDigest, const char *sHexText, const char *sHexKey);

/* MD5 PROTOTYPES */
long _stdcall MD5_StringHexHash(char *szDigest, const char *szMessage);
long _stdcall MD5_FileHexHash(char *szDigest, const char *szFileName, const char *szMode);
long _stdcall MD5_BytesHexHash(char *szDigest, const unsigned char *lpData, long nDataLen);
long _stdcall MD5_BytesHash(unsigned char *digest, const unsigned char *lpData, long nDataLen);
long _stdcall MD5_Init(void);
long _stdcall MD5_AddString(long hContext, const char *szMessage);
long _stdcall MD5_AddBytes(long hContext, const unsigned char *lpData, long nDataLen);
long _stdcall MD5_HexDigest(char *szDigest, long hContext);
long _stdcall MD5_Reset(long hContext);
long _stdcall MD5_Hmac(char *szDigest, const unsigned char *textBytes, long textLen, const unsigned char *lpKeyBytes, long keyLen);
long _stdcall MD5_HmacHex(char *szDigest, const char *szHexText, const char *szHexKey);

/* RC4-COMPATIBLE PC1 PROTOTYPES */
long _stdcall PC1_Bytes(unsigned char *lpOutput, unsigned char *lpInput, long nBytes, unsigned char *lpKey, long nKeyBytes);
long _stdcall PC1_File(char *szFileOut, char *szFileIn, unsigned char *lpKey, long nKeyBytes);
long _stdcall PC1_Hex(char *szOutput, long nMaxChars, const char *szInputHex, const char *szKeyHex);

/* RNG PROTOTYPES */
long _stdcall RNG_KeyBytes(unsigned char *lpOutput, long nOutputLen, const void *lpSeed, long nSeedLen);
long _stdcall RNG_KeyHex(char *szOutput, long nMaxChars, long nBytes, const void *lpSeed, long nSeedLen);
long _stdcall RNG_NonceData(unsigned char *lpOutput, long nBytes);
long _stdcall RNG_NonceDataHex(char *szOutput, long nMaxChars, long nBytes);
long _stdcall RNG_Test(const char *szFileName);
long _stdcall RNG_Number(long nLower, long nUpper);
long _stdcall RNG_BytesWithPrompt(unsigned char *lpOutput, long nOutputLen, const char *szPrompt, long nOptions);
long _stdcall RNG_HexWithPrompt(char *szOutput, long nMaxChars, long nBytes, const char *szPrompt, long nOptions);
long _stdcall RNG_Initialize(const char *szSeedFile, long nOptions);
long _stdcall RNG_MakeSeedFile( const char *szSeedFile, const char *szPrompt, long nOptions);
long _stdcall RNG_UpdateSeedFile(const char *szSeedFile, long nOptions);

/* ZLIB COMPRESSION PROTOTYPES */
long _stdcall ZLIB_Deflate(unsigned char *lpOutput, long nOutputLen, const unsigned char *lpInput, long nBytes);
long _stdcall ZLIB_Inflate(unsigned char *lpOutput, long nOutputLen, const unsigned char *lpInput, long nBytes);

/* PASSWORD-BASED ENCRYPTION PROTOTYPES */
long _stdcall PBE_Kdf2(unsigned char *lpOutput, long nOutputLen, const unsigned char *lpPwd, long nPwdLen, const unsigned char *lpSalt, long nSaltLen, long nCount, long nOptions);
long _stdcall PBE_Kdf2Hex(char *szOutput, long nMaxChars, long dkBytes, const char *szPwd, const char *szSaltHex, long nCount, long nOptions);

/* HEX CONVERSION PROTOTYPES */
long _stdcall CNV_HexStrFromBytes(char *szOutput, long nMaxChars, const unsigned char *lpInput, long nBytes);
long _stdcall CNV_BytesFromHexStr(unsigned char *lpOutput, long nOutputLen, const char *szInput);
long _stdcall CNV_HexFilter(char *szOutput, const char *szInput, long nInStrLen);

/* BASE64 CONVERSION PROTOTYPES */
long _stdcall CNV_B64StrFromBytes(char *szOutput, long nMaxChars, const unsigned char *lpInput, long nBytes);
long _stdcall CNV_BytesFromB64Str(unsigned char *lpOutput, long nOutputLen, const char *szInput);
long _stdcall CNV_B64Filter(char *szOutput, const char *szInput, long nInStrLen);

/* CRC-32 CHECKSUM PROTOTYPES */
long _stdcall CRC_Bytes(const unsigned char *lpInput, long nBytes, long nOptions);
long _stdcall CRC_String(const char *szInput, long nOptions);
long _stdcall CRC_File(const char *szFileName, long nOptions);

/* WIPE PROTOTYPES */
long _stdcall WIPE_Data(void *lpData, long nDataLen);
long _stdcall WIPE_File(const char *szFileName, long nOptions);

/* PADDING PROTOTYPES */
long _stdcall PAD_BytesBlock(unsigned char *lpOutput, long nOutputLen, const unsigned char *lpInput, long nBytes, long nBlkLen, long nOptions);
long _stdcall PAD_UnpadBytes(unsigned char *lpOutput, long nOutputLen, const unsigned char *lpInput, long nBytes, long nBlkLen, long nOptions);
long _stdcall PAD_HexBlock(char *szOutput, long nMaxChars, const char *szInput, long nBlkLen, long nOptions);
long _stdcall PAD_UnpadHex(char *szOutput, long nMaxChars, const char *szInput, long nBlkLen, long nOptions);


/* DEPRECATED FUNCTIONS -- [REMOVED IN v4.5] */

#ifdef __cplusplus
}
#endif

#endif /* DICRYPTOSYS_H_ */