/* written by drizz <1of00@gmx.net> */

extern "C" {

// CIPHERS
// =======

__stdcall DESSetKey ( BYTE *pKey );
__stdcall DESSetKeyEnc ( BYTE *pKey );
__stdcall DESSetKeyDec ( BYTE *pKey );
__stdcall DESEncrypt ( BYTE *pBlockIn,BYTE *pBlockOut );
__stdcall DESDecrypt ( BYTE *pBlockIn,BYTE *pBlockOut );
__stdcall TwofishInit (DWORD,DWORD);
__stdcall TwofishEncrypt (DWORD,DWORD);
__stdcall TwofishDecrypt (DWORD,DWORD);
__stdcall RC2Init ( BYTE *pKey,DWORD dwKeyLen );
__stdcall RC2Encrypt ( BYTE *pBlockIn,BYTE *pBlockOut );
__stdcall RC2Decrypt ( BYTE *pBlockIn,BYTE *pBlockOut );
__stdcall RC4Init ( BYTE *pKey,DWORD dwKeyLen );
__stdcall RC4Encrypt ( BYTE *pBlock,DWORD dwBlockLen );
#define RC4Decrypt RC4Encrypt
__stdcall RC5Init       ( BYTE *pKey );
__stdcall RC5Encrypt    ( BYTE *pBlockIn,BYTE *pBlockOut );
__stdcall RC5Decrypt    ( BYTE *pBlockIn,BYTE *pBlockOut );
__stdcall RC6Init       ( BYTE *pKey,DWORD dwKeyLen );
__stdcall RC6Encrypt    ( BYTE *pBlockIn,BYTE *pBlockOut );
__stdcall RC6Decrypt    ( BYTE *pBlockIn,BYTE *pBlockOut );
__stdcall XTEAInit	( BYTE *pKey,DWORD dwRounds );
__stdcall XTEAEncrypt	( BYTE *pBlockIn,BYTE *pBlockOut );
__stdcall XTEADecrypt	( BYTE *pBlockIn,BYTE *pBlockOut );
__stdcall RijndaelInit ( BYTE *pKey,DWORD dwKeyLen );
__stdcall RijndaelEncrypt	( BYTE *pBlockIn,BYTE *pBlockOut );
__stdcall RijndaelDecrypt	( BYTE *pBlockIn,BYTE *pBlockOut );
__stdcall ThreeWayInit    ( BYTE *pKey );
__stdcall ThreeWayEncrypt ( BYTE *pBlockIn,BYTE *pBlockOut );
__stdcall ThreeWayDecrypt ( BYTE *pBlockIn,BYTE *pBlockOut );
__stdcall TEAInit	( BYTE *pKey );
__stdcall TEAEncrypt	( BYTE *pBlockIn,BYTE *pBlockOut );
__stdcall TEADecrypt	( BYTE *pBlockIn,BYTE *pBlockOut );
__stdcall BlowfishInit ( BYTE *pKey,DWORD dwKeyLen );
__stdcall BlowfishEncrypt	( BYTE *pBlockIn,BYTE *pBlockOut );
__stdcall BlowfishDecrypt	( BYTE *pBlockIn,BYTE *pBlockOut );

// CHECKSUMS
// =========

#define INIT_CRC32 0
#define INIT_CRC16 0
#define INIT_ADLER32 1
__stdcall CRC32 ( BYTE *lpBuffer,DWORD dwBufLen,DWORD dwCRC );   // init dwCRC = 0
__stdcall RCRC32 ( BYTE *pData,DWORD dwDataLen,DWORD dwOffset,DWORD dwWantCrc );   // reverse CRC32
__stdcall CRC16 ( BYTE *lpBuffer,DWORD dwBufLen,DWORD dwCRC );   // init dwCRC = 0
__stdcall Adler32 ( BYTE *lpBuffer,DWORD dwBufLen,DWORD dwAdler ); // init dwAdler = 1

// HASHES
// ======

BYTE * __stdcall MD5Init ( void );
__stdcall MD5Update ( BYTE *lpBuffer,DWORD dwBufLen );
BYTE * __stdcall MD5Final ( void );
#define MD5_DIGESTSIZE (128/8)
BYTE * __stdcall MD4Init ( void );
__stdcall MD4Update ( BYTE *lpBuffer,DWORD dwBufLen );
BYTE * __stdcall MD4Final ( void );
#define MD4_DIGESTSIZE (128/8)
BYTE * __stdcall MD2Init ( void );
__stdcall MD2Update ( DWORD, DWORD );
BYTE * __stdcall MD2Final ( void );
#define MD2_DIGESTSIZE (128/8)
BYTE * __stdcall RMD128Init ( void );
__stdcall RMD128Update ( BYTE *lpBuffer,DWORD dwBufLen );
BYTE * __stdcall RMD128Final ( void );
#define RMD128_DIGESTSIZE (128/8)
BYTE * __stdcall RMD160Init ( void );
__stdcall RMD160Update ( BYTE *lpBuffer,DWORD dwBufLen );
BYTE * __stdcall RMD160Final ( void );
#define RMD160_DIGESTSIZE (160/8)
BYTE * __stdcall RMD256Init ( void );
__stdcall RMD256Update ( BYTE *lpBuffer,DWORD dwBufLen );
BYTE * __stdcall RMD256Final ( void );
#define RMD256_DIGESTSIZE (256/8)
BYTE * __stdcall RMD320Init ( void );
__stdcall RMD320Update ( BYTE *lpBuffer,DWORD dwBufLen );
BYTE * __stdcall RMD320Final ( void );
#define RMD320_DIGESTSIZE (320/8)
BYTE * __stdcall SHA0Init ( void );
__stdcall SHA0Update ( BYTE *lpBuffer,DWORD dwBufLen );
BYTE * __stdcall SHA0Final ( void );
#define SHA0_DIGESTSIZE (160/8)
BYTE * __stdcall SHA1Init ( void );
__stdcall SHA1Update ( BYTE *lpBuffer,DWORD dwBufLen );
BYTE * __stdcall SHA1Final ( void );
#define SHA1_DIGESTSIZE (160/8)
BYTE * __stdcall SHA256Init ( void );
__stdcall SHA256Update ( BYTE *lpBuffer,DWORD dwBufLen );
BYTE * __stdcall SHA256Final ( void );
#define SHA256_DIGESTSIZE (256/8)
BYTE * __stdcall SHA384Init ( void );
__stdcall SHA384Update ( BYTE *lpBuffer,DWORD dwBufLen );
BYTE * __stdcall SHA384Final ( void );
#define SHA384_DIGESTSIZE (384/8)
BYTE * __stdcall SHA512Init ( void );
__stdcall SHA512Update ( BYTE *lpBuffer,DWORD dwBufLen );
BYTE * __stdcall SHA512Final ( void );
#define SHA512_DIGESTSIZE (512/8)
BYTE * __stdcall WhirlpoolInit ( void );
__stdcall WhirlpoolUpdate ( BYTE *lpBuffer,DWORD dwBufLen );
BYTE * __stdcall WhirlpoolFinal ( void );
#define WHIRLPOOL_DIGESTSIZE (512/8)
BYTE * __stdcall TigerInit ( void );
__stdcall TigerUpdate ( BYTE *lpBuffer,DWORD dwBufLen );
BYTE * __stdcall TigerFinal ( void );
#define TIGER_DIGESTSIZE (192/8)
BYTE * __stdcall HavalInit ( DWORD DigestSizeBits,DWORD Passes  );// variable digest & passes !!!
__stdcall HavalUpdate ( BYTE *lpBuffer,DWORD dwBufLen );
BYTE * __stdcall HavalFinal ( void );


// TEXT UTILS
// ==========

DWORD __stdcall HexEncode ( BYTE *pBuff,DWORD dwLen,BYTE *pOutBuff );// sizeof pOutBuff must be (dwLen)*2+2
DWORD __stdcall HexDecode (BYTE *pHexStr,BYTE *pOutBuffer); //sizeof pOutBuff must be StrLen(pHexStr)/2+1
DWORD __stdcall Base64Encode ( BYTE *pInputData,DWORD dwDataLen,BYTE *pOutputStr );// sizeof pOutputStr must be (dwLen)*4/3
DWORD __stdcall Base64Decode ( BYTE *pInputStr,BYTE *pOutputData );// result = length
DWORD __stdcall Base2Decode ( BYTE *pInputStr:dword,BYTE *pOutputData);// result = length
DWORD __stdcall Base2Encode ( BYTE *pInputData:dword,DWORD dwDataLen,BYTE *pOutputData);// result = length


}
