xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HB_MD5File()

Calculates a message digest for a file using the MD5 algorithm.

Syntax

HB_MD5File( <cFileName> ) --> cMD5

Arguments

<cFileName>
This is a character string holding the name of the file to process. It must include path and file extension. If the path is omitted from <cFileName>, the file is searched in the current directory.

Return

The function returns a character string of 32 characters which is the message digest of the file specified.

Description

HB_MD5File() does the same as HB_MD5() but processes an entire file rather than a character string. The result is the message digest of the file <cFileName> which can be used to detect if the file is changed.

Info

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

Example

// The example implements a simple command line tool that
// displays the MD5 message digest of a file.

   PROCEDURE Main( cFileName )
      IF PCount() > 0 .AND. File( cFileName )
         ? HB_MD5File( cFileName )
      ELSE
         ? "Usage: MD5File <filename>"
      ENDIF
   RETURN

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