|
QuickHash Library |
C++ Interface |
|
CSHA512::FinalHex
void FinalHex( char* pDest, bool
bUpper = false );
Parameters
pDest
[out] Pointer to the text
buffer that will receive the message digest.
bUpper
[in] Uppercase flag.
If
bUpper is false, the received message digest represents a lowercase string,
otherwise it represents an uppercase string.
Remarks
Call this member function to retrieve the message digest from the CSHA512
object. The digest is retrieved as a null-terminated hexadecimal string in the
text buffer
pointed by pDest. The size of the text buffer pointed by pDest
must be at least CSHA512::HEXDIGESTSIZE characters.
After the FinalHex method is performed, the CSHA512
object is initialized for new calculations, as it would be constructed
again.
Example
#include <fstream>
#include <QuickHash.h>
using namespace std;
using namespace QuickHash;
const unsigned int BUFF_SIZE = 1024;
int main()
{
fstream file( "c:\\test.txt", ios::in | ios::binary );
if( !file )
return 1;
unsigned char buff[ BUFF_SIZE ];
char digesthex[ CSHA512::HEXDIGESTSIZE ]; //0 terminated
//Instantiate a CSHA512 object
CSHA512 hash;
//Calculate the digest incrementally block by block using Update
while( !file.eof() )
{
file.read( ( char* )buff, BUFF_SIZE );
hash.Update( buff, file.gcount() );
}
//Do final changes and get the digest in hex format
hash.FinalHex( digesthex );
//Use the digest
//...
file.close();
return 0;
}
|
|
CSHA512 Overview
| Class Members
|
Useful Links | HashCalc
See Also CSHA512::Final, CSHA512::Update
|