Click here to Skip to main content
13,047,502 members (59,876 online)
Click here to Skip to main content
Add your own
alternative version


27 bookmarked
Posted 30 Mar 2004

Message Digest Application

, 30 Mar 2004
Rate this:
Please Sign up or sign in to vote.
A program which generates the various Message Digests using only one Class, also including the different techniques for Base 64 Encoding And Decoding


This is class which generates the Message Digest using Various algorithms. It gives support to various algorithms such as MD4 - both 128 bits and 256 bits, MD5, RIPEMD-128, RIPEMD-160, RIPEMD-256, RIPEMD-320, SHA-1, SHA-256, SHA-384, SHA-512, HAVAL SERIES and BASE 64 Encoding and Decoding.

Using the code

This one program can be used for various purpose

  1. You can create the .dll file and can use it
  2. You can create the .exe file and use it as Console Based Utility

For creating the Console based utility

  • Include all the files except the MessageDigest.def file
  • Compile Main.cpp in VC++ 6.0 and then run it

Note:- Please remove all the files from the build expect the Main.cpp while you are creating the Console based utility.

Help is included in the Main.cpp or you can run the .exe file with parameters as (NULL, -?, -help)

For creating the dll file

Include the file MessageDigest.def file and remove the main.cpp, main.h, system.h files. Then compile the "Export.cpp" and build the MessageDigest.dll

//This is the Structure of Class which will do Everything

class Signature_Context

  UCHAR ucCur_Size_of_Buffer;
  UCHAR ucCheck;
  UCHAR ucSignature_Type;
  UCHAR ucDigest_Length;

  DOUBLE dProgress,dDelta_Progress;
  Progress ShowProgress;

    FILE * OutFileStream;
    PCHAR  lpChar;

  union Finger_Prints
    ULONGLONG ullValues[8];
    ULONG     ulValues[16];
    UINT    uiValues[32];
    UCHAR     ucValues[64];
    UCHAR    ucullValues[8][8];
    UCHAR    uculValues[16][4];
    UCHAR ucBlockSize;
      PUCHAR     ucValues;
      PSHORT     sValues;
      PULONG     ulValues;
      PULONGLONG ullValues;

    ULONGLONG ullLength;
    UCHAR ucChar_Codes[8];
      unsigned Bit_4:6;
      unsigned Bit_3:6;
      unsigned Bit_2:6;
      unsigned Bit_1:6;

  // Private Functions
  LONG Initialize(UCHAR,UCHAR);
  VOID Destroy(VOID);

  LONG Expected_FileSize(ULONGLONG &);

  VOID MD4_Transform(VOID);
  VOID MD5_Transform(VOID);
  VOID SHA1_Transform(VOID);
  VOID SHA256_Transform(VOID);
  VOID SHA_384_512_Transform(VOID);
  VOID RIPEMD_128_256_Transform(VOID);
  VOID RIPEMD_160_320_Transform(VOID);
  VOID HAVAL_Transform(SHORT);


  VOID Signature_Transform(UCHAR);

  VOID Signature_Final(UCHAR);

  VOID BASE64_Encode_Update(PCHAR,ULONG &);
  VOID Base64_Encode_Final(VOID);
  VOID BASE64_Decode(PCHAR);

  Signature_Context(UCHAR = MD_5, UCHAR = 0); // Parameterized Constructor
  ~Signature_Context(VOID); // Destructor

         UCHAR = 3,UCHAR = 0,SHORT = 0,  
             LONG = NULL,LONG = NULL);

  VOID Signature_Update(PCHAR,ULONG &);

Points of Interest

  1. Special Logic has been developed for Base 64 encoding and decoding
  2. A some what different implementation for calculating the Message Digest
  3. In all 16 Message Digest algorithms are supported
  4. Given support to MD4 256 bit algorithm, which require 2 copies of code running parallelly
  5. Implementation of AppendChunk method which will take in some extra input while processing (Not in Console Based)
  6. The program gives back the progress of transformation (Not in Console Based)

Special Logic used for BASE 64 Encoding and Decoding.

I had used the concept of bit datatype. Check out the cool code and also the speed which i had reduced for calculation of BASE 64 Encoding and Decoding

I wonder "Why people use the shifting logic when they had Bit Data type Which gradually increases the Execution time"

An efficient use of CALLBACK from C++

Lastly, I would like to thank Respected Sir, Shyam R. Soni for his priceless guidance through out this project. It would be never be possible without him. I would also like to thanks Dominik Reichl for his very valuable tips and guidance


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


About the Author

Shinde Vikram V.
Web Developer
India India
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralUsefull Pin
Cem Kalyoncu16-Aug-06 23:20
memberCem Kalyoncu16-Aug-06 23:20 
GeneralCompiler Errors Pin
ivax3-Oct-05 23:13
memberivax3-Oct-05 23:13 
GeneralRe: Compiler Errors Pin
Cem Kalyoncu16-Aug-06 23:13
memberCem Kalyoncu16-Aug-06 23:13 
GeneralMD4 -> little question... Pin
dghhngd4522-Sep-04 0:58
memberdghhngd4522-Sep-04 0:58 
GeneralRe: MD4 -> little question... Pin
Shinde Vikram23-Sep-04 17:31
memberShinde Vikram23-Sep-04 17:31 
GeneralRe: MD4 -> little question... Pin
dghhngd4523-Sep-04 22:15
memberdghhngd4523-Sep-04 22:15 
GeneralRe: MD4 -> little question... Pin
Anonymous24-Sep-04 4:45
sussAnonymous24-Sep-04 4:45 
GeneralRe: MD4 -> little question... Pin
Shinde Vikram24-Sep-04 18:49
memberShinde Vikram24-Sep-04 18:49 
GeneralRe: MD4 -> little question... Pin
Anonymous25-Sep-04 10:12
sussAnonymous25-Sep-04 10:12 
Generalplz give me suggestions Pin
Shinde Vikram8-Apr-04 7:22
memberShinde Vikram8-Apr-04 7:22 
GeneralRe: plz give me suggestions Pin
Philippe Lhoste8-Apr-04 10:23
memberPhilippe Lhoste8-Apr-04 10:23 
GeneralRe: plz give me suggestions Pin
Shinde Vikram10-Apr-04 21:37
memberShinde Vikram10-Apr-04 21:37 
GeneralRe: plz give me suggestions Pin
MilanTomic7811-May-04 22:59
memberMilanTomic7811-May-04 22:59 
GeneralRe: plz give me suggestions Pin
Shinde Vikram13-May-04 7:18
memberShinde Vikram13-May-04 7:18 
GeneralRe: plz give me suggestions Pin
MilanTomic7811-May-04 23:04
memberMilanTomic7811-May-04 23:04 
GeneralRe: plz give me suggestions Pin
Shinde Vikram13-May-04 6:52
memberShinde Vikram13-May-04 6:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 31 Mar 2004
Article Copyright 2004 by Shinde Vikram V.
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid