Click here to Skip to main content
15,885,537 members
Articles / Desktop Programming / MFC

Exile 1.8 - The Password Manager

Rate me:
Please Sign up or sign in to vote.
4.57/5 (51 votes)
6 Mar 20058 min read 255.2K   7.4K   111  
Yet another password manager.
#ifndef __MDX_H__
#define __MDX_H__

// The following ifdef block is the standard way of creating macros which make exporting 
// from a DLL simpler. All files within this DLL are compiled with the MDX_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see 
// MDX_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.

#ifdef MDX_EXPORTS
#define MDX_API extern "C" __declspec(dllexport)
#else
#define MDX_API extern "C" __declspec(dllimport)
#endif

BOOL WINAPI DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved);

//////////////////////////////////////////////////////////////////////////
// MDX Types

// MDX Word
typedef unsigned long int MDX_WORD;

// MDX Hashing Context
typedef unsigned long int HMDXCONTEXT;

// MDX Hash
typedef struct tagMDXHASH {
	MDX_WORD wA;
	MDX_WORD wB;
	MDX_WORD wC;
	MDX_WORD wD;
} MDXHASH, *LPMDXHASH;

// MDX Hashing Context
typedef struct tagMDXCONTEXT {
	MDXHASH hsState;
	BYTE *pBuffer; // To buffer data which is still to be hashed
	unsigned int unBuffer; // Buffer index
	unsigned int unSize; // Total size of data hashed (in bytes)
} MDXCONTEXT, *LPMDXCONTEXT;


// Initializes MDX internal structures
MDX_API BOOL MdxInitialize();

// Uninitializes and performs cleanup
MDX_API BOOL MdxUninitialize();

// Acquire initialized MDX Hashing context.
MDX_API BOOL MdxAcquireContext(HMDXCONTEXT &hMdx);

// Release MDX Hashing context
MDX_API BOOL MdxReleaseContext(HMDXCONTEXT &hMdx);

// Resets a hashing context so new data block can be hashed
MDX_API BOOL MdxResetContext(HMDXCONTEXT hMdx);

// Determine if given context is a valid one
MDX_API BOOL MdxValidContext(HMDXCONTEXT hMdx);

// Hashes a buffer (pBuffer) of a given size (sBuffer) and
// awaits either for a next part of a message, or for
// a call to MdxHashFinal()
MDX_API BOOL MdxHashBuffer(HMDXCONTEXT hMdx, BYTE *pBuffer, size_t sBuffer);

// Hashes buffered data (if any), produces a final hash
// and automatically resets hashing context.
MDX_API BOOL MdxHashFinal(HMDXCONTEXT hMdx, MDXHASH &hsMdx);

// This function should not be called under normal
// circumstances, but anyway it can be useful for some
// specific purposes. It hashes a 512-block (only!) of data
// with already defined hash value.
MDX_API BOOL MdxHashDependentBuffer(MDX_WORD *pwData, MDXHASH &hMdx);

// Calculates buffer size required for data expansion
MDX_API size_t MdxGetExpandedBufferSize(size_t sSize);

// Expands data buffer pointed by pvData. Buffer must be sTotal bytes long
// and must contain sSgSize bytes of significant data. Remaining bytes
// will be by MdxExpandData()
MDX_API BOOL MdxExpandData(void *pvData, size_t sSgSize, size_t sTotal);

// Hashes message of nBlocks 512-bit blocks pointed by pwData.
MDX_API BOOL MdxHashData(MDX_WORD *pwData, UINT nBlocks, MDXHASH &hMdx);

// Tests if two hashes are equal
MDX_API BOOL MdxEqualHashes(MDXHASH hsMdxA, MDXHASH hsMdxB);

#endif //__MDX_H__

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Russian Federation Russian Federation
I'll think about it later on...

Comments and Discussions