Navigation:  Reference > Functions By Category >

MD5 Functions

Previous pageReturn to chapter overviewNext page

Ready to use MD5 functions:

 

This set of MD5 functions computes the MD5 algorithm in a single step

this means that the resulting MD5 cannot be updated by adding new content.

 

Computes MD5 from the provided string:

 

Str2Md5Hex(cStr)

Str2Md5Bin(cStr) 

 

Computes MD5 from the current position of hFile to the end of the file
( hFile can be also a pipe handle ):

 

HFile2Md5Hex(hFile)

HFile2Md5Bin(hFile) 

 

Computes MD5 from the provided file:

 

File2Md5Hex(cFileName)

File2Md5Bin(cFileName)

 

Step by step MD5 functions

 

This set of functions are intended to generate a MD5 hash from some chunks of data.

When no more chunks to add you must finalize the MD5 hash.

After the MD5 hash has been finalized cannot be added more chunks of data to the calculation.

 

ot4xb use internally a C++ class to handle the MD5 calculation, so you need initialize the C++ class by using                        hMd5 := _MD5_NEW()

and release the working resources when not needed anymore calling:  

       _MD5_DESTROY(hMd5)        

After        _MD5_FINALIZE(hMd5)        you can get the results in binary format for small storage or human readable in hexadecimal.

 

_MD5_NEW( )   -> hMd5     Handle to internal MD5 C++  class

_MD5_STR(hMd5 , str [ , nLen] )  -> lOk    

       <str> can be a Xbase++ string or a memory pointer.

       If <str> is a memory pointer nLen is required

_MD5_HFILE( hMd5 , hFile ) -> lOk

       Add the contents of the provided file or pipe handle to the MD5 calculation,

       from the current position to the end of the file

_MD5_FINALIZE( hMd5) -> lOk

       Finalize the MD5 hash calculation. This step is required before retrieve the MD5 hash value.

       After call this function cannot be added more chunks of data to the calculation.

_MD5_GETHEX( hMd5 ) -> cMd5StrAsHex

       Return the value of the MD5 hash as human readable hexadecimal string

       The hash must be finalized before call to this function.

_MD5_GETBIN( hMd5 ) -> cMd5BinStr

       Return the value of the MD5 hash as human readable hexadecimal string

       The hash must be finalized before call to this function.

_MD5_DESTROY( hMd5 )

       Release memory and resources used for the MD5 calculation when no longer required.