I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
this unit 1.00
sub units 0.00


Implements the Message-Digest algorithm 5.
Controller: CodeCogs




This module implements the MD5 (Message-Digest algorithm 5) algorithm, which is a 128-bit valued hash function designed by Ron Rivest in 1991. Its main application is to check the integrity of data, but it can also be used in conjunction with cryptosystems like RSA.

The idea of the algorithm is to encode the input message using four 32-bit registers and by going through a series of bitwise operations, based on the following four functions:

The algorithm also uses a number of 64 constants c_0, c_1, ..., c_{63} defined through:

where \lfloor \cdot \rfloor denotes the floor function.

The following example displays the MD5 code for the string "somewhere over the rainbow".

Example 1

#include <iostream>
#include <codecogs/computing/security/md5.h>
int main()
  std::string data = "somewhere over the rainbow";
  std::cout << "Input: " << data << std::endl;
  std::cout << "  MD5: " << Computing::Security::md5(data) << std::endl;
  return 0;

Input: somewhere over the rainbow
  MD5: fe6acc5bea48d66ac6baa60ff73f6d62


Lucian Bentea (July 2009)


  1. The MD5 Message-Digest Algorithm (RFC1321), http://tools.ietf.org/html/rfc1321
  2. The description of the MD5 algorithm on Wikipedia, http://en.wikipedia.org/wiki/MD5
  3. Free online MD5 hash calculator based on PHP, http://md5-hash-online.waraxe.us


std::stringmd5std::string& str )[inline]
This function generates the unique MD5 code corresponding to the given string, in the form of a 32 digits hexadecimal number.

For example, to obtain the MD5 code of the string "Hello World", you would write something similar to:

std::string md5Code = Computing::Security::Hash::md5("Hello World");


strthe string to be hashed


the MD5 code corresponding to str, as a 32 digits hexadecimal number stored as a string
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.