xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HB_MD5()

Calculates a message digest for a stream of data using the MD5 algorithm.

Syntax

HB_MD5( <cString> ) --> cMD5

Arguments

<cString>
This is a character string to calulate the message disgest for.

Return

The function returns a character string of 32 characters which is the message digest of <cString>.

Description

HB_MD5() is a cryptographic hash function wich accepts a variable length character string (or message) as input, and produces a fixed length string as output, also known as Message Digest or Digital Fingerprint. The algorithm used is the MD5 algorithm.

Info

See also:HB_CheckSum(), HB_CRC32(), HB_MD5File()
Category: Checksum functions , xHarbour extensions
Source:rtl\hbmd5.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example displays the message digest of severeal character
// strings, including null string.

   PROCEDURE Main
      ? HB_MD5("")     // result: d41d8cd98f00b204e9800998ecf8427e

      ? HB_MD5("a")    // result: 0cc175b9c0f1b6a831c399e269772661

      ? HB_MD5("abc")  // result: 900150983cd24fb0d6963f7d28e17f72

      ? HB_MD5("message digest")
                       // result: f96b697d7cb7938d525a2f31aaf161d0
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe