How Translate this function in Delphi to FWH

How Translate this function in Delphi to FWH

Postby lailton.webmaster » Thu Oct 22, 2009 2:27 am

Code: Select all  Expand view
Private String geraHash(String Arquivo)
{
 String HashGerado;
 ASCIIEncoding textConverter = newASCIIEncoding();
 MD5CryptoServiceProvider Md5Provider = new MD5CryptoServiceProvider();
 Byte[] ArquivoByte;
 Arquivo = Arquivo.Replace("\r","").Replace("\n","").Replace("\t","");
 ArquivoByte = textConverter.GetBytes(Arquivo);
 ArquivoByte = Md5Provider.ComputerHash(ArquivoByte);
 HashGerado  = ToHexString(ArquivoByte);
 return HashGerado;
}
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: How Translate this function in Delphi to FWH

Postby Antonio Linares » Thu Oct 22, 2009 12:21 pm

Lailton,

You can use these functions from [x]Harbour:
PRG functions:

HB_MD5( <cString> ) -> <cMD5>
Calculates RFC 1321 MD5 digest (128-bit checksum)
Parameters:
<cString> - string variable to calculate MD5
Returns:
ASCII hex MD5 digest as 32-byte string
empty string on error

HB_MD5FILE( <cFileName> ) -> <cMD5>
Calculates RFC 1321 MD5 digest (128-bit checksum) of a file contents
(file size is limited by OS limits only)
Parameters:
<cFileName> - file name
Returns:
ASCII hex MD5 digest as 32-byte string
empty string on error

C functions:

void hb_md5( const void * data, ULONG datalen, char * digest )
Parameters:
data - input byte stream
datalen - input stream length
digest - raw (unformatted) MD5 digest buffer
(at least 16 bytes long)

void hb_md5file( HB_FHANDLE hFile, char * digest )
Parameters:
hFile - file handle
digest - raw (unformatted) MD5 digest buffer
(at least 16 bytes long)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: How Translate this function in Delphi to FWH

Postby lailton.webmaster » Thu Oct 22, 2009 12:28 pm

gracias antonio,
voy provar.
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 85 guests