Main Page | Modules | File List | File Members

One-way hash functions

One-way hash functions. More...

Functions

GSbool GenerateRawHash (GSCRYPTO_HASH_ALGO eAlgo, const GSubyte *pucInBuffer, GSuint uiBufferSize, GSubyte *pucOutBuffer, GSuint uiIterations=1)
 Generate binary hash.

GSbool GenerateHexaHash (GSCRYPTO_HASH_ALGO eAlgo, const GSubyte *pucInBuffer, GSuint uiBufferSize, GSchar *pszOutBuffer, GSuint uiIterations=1)
 Generate hexadecimal hash.

GShandle InitializeHash (GSCRYPTO_HASH_ALGO eAlgo)
 Initialize the hash context.

GSbool UpdateHash (GShandle hHash, const GSubyte *pucInBuffer, GSuint uiBufferSize, GSuint uiIterations=1)
 Update the internal hash context.

GSbool TerminateRawHash (GShandle hHash, GSubyte *pucOutBuffer)
 Terminate the hash context, output binary hashed result.

GSbool TerminateHexaHash (GShandle hHash, GSchar *pszOutBuffer)
 Terminate the hash context, output hexadecimal hashed result.

GSbool ResetHash (GShandle hHash)
 Reset the hash module.

GSvoid UninitializeHash (GShandle hHash)
 Uninitiaze the hash module.


Detailed Description

These functions are used to get cryptographic checksums from supplied input buffers.

Function Documentation

GSbool GenerateHexaHash GSCRYPTO_HASH_ALGO  eAlgo,
const GSubyte *  pucInBuffer,
GSuint  uiBufferSize,
GSchar *  pszOutBuffer,
GSuint  uiIterations = 1
 

Description:
This function generate a hash in hexadecimal form from a supplied input value. The output buffer must be at least (SHA1_HEXASIZE) byte long for the SHA1 (E_SHA1) algorithm and at leat (MD5_HEXASIZE) byte long for the MD5 (E_MD5) algorithm. It is important to note that this function does not put a at the end of the output buffer, so the programmer will have to terminate the output string once he gets it. The number of iteration can be modified to change the hashed output value, it represent the number of passed the input value is put through the hash algorithm.
Returns:
Status of the function call
Return values:
GS_TRUE the operation suceeded.
GS_FALSE the operation failed.
Parameters:
IN eAlgo The type of hash algorithm to use.
IN pucInBuffer The input buffer to be hashed.
IN uiBufferSize The lenght of the input buffer.
OUT pszOutBuffer Hexadecimal output of the generated hashed value.
IN uiIterations = 1 Nuber of time to hash the input value.

GSbool GenerateRawHash GSCRYPTO_HASH_ALGO  eAlgo,
const GSubyte *  pucInBuffer,
GSuint  uiBufferSize,
GSubyte *  pucOutBuffer,
GSuint  uiIterations = 1
 

Description:
This function generate a hash in binary form from a supplied input value. The output buffer must be at least (SHA1_DIGESTSIZE) byte long for the SHA1 (E_SHA1) algorithm and at leat (MD5_DIGESTSIZE) byte long for the MD5 (E_MD5) algorithm. The number of iteration can be modified to change the hashed output value, it represent the number of passed the input value is put through the hash algorithm.
Returns:
Status of the function call
Return values:
GS_TRUE the operation suceeded.
GS_FALSE the operation failed.
Parameters:
IN eAlgo The type of hash algorithm to use.
IN pucInBuffer The input buffer to be hashed.
IN uiBufferSize The lenght of the input buffer.
OUT pucOutBuffer Binary output of the generated hashed value.
IN uiIterations Nuber of time to hash the input value.

GShandle InitializeHash GSCRYPTO_HASH_ALGO  eAlgo  ) 
 

Description:
This function will initialize the hash context. This must be called before any call to the UpdateHash() function. This function will return GS_FALSE if the hash context is not yet terminated.
Returns:
Status of the function call
Return values:
Identification of the hash algorithm created
NULL if the operation failed
Parameters:
IN eAlgo The type of hash algorithm to use.

GSbool ResetHash GShandle  hHash  ) 
 

Description:
Reset the hash module
Returns:
Status of the function call
Return values:
GS_TRUE the operation suceeded.
GS_FALSE the operation failed.
Parameters:
hHash Handle on the hash module

GSbool TerminateHexaHash GShandle  hHash,
GSchar *  pszOutBuffer
 

Description:
This function terminate the hash context and output the hashed result in hexadecimal form. The output buffer must be at least (SHA1_HEXASIZE) byte long for the SHA1 (E_SHA1) algorithm and at leat (MD5_HEXASIZE) byte long for the MD5 (E_MD5) algorithm. It is important to note that this function does not put a at the end of the output buffer, so the programmer will have to terminate the output string once he gets it. This function will return GS_FALSE if the hash context is already terminated.
Returns:
Status of the function call
Return values:
GS_TRUE the operation suceeded.
GS_FALSE the operation failed.
Parameters:
IN hHash Handle to the hash to be terminated
OUT pszOutBuffer Hexadecimal output of the generated hashed value.

GSbool TerminateRawHash GShandle  hHash,
GSubyte *  pucOutBuffer
 

Description:
This function terminate the hash context and output the hashed result in binary form. The output buffer must be at least (SHA1_DIGESTSIZE) byte long for the SHA1 (E_SHA1) algorithm and at leat (MD5_DIGESTSIZE) byte long for the MD5 (E_MD5) algorithm. This function will return GS_FALSE if the hash context is already terminated.
Returns:
Status of the function call
Return values:
GS_TRUE the operation suceeded.
GS_FALSE the operation failed.
Parameters:
IN hHash Handle to the hash to be terminated
OUT pucOutBuffer Binary output of the generated hashed value.

GSvoid UninitializeHash GShandle  hHash  ) 
 

Description:
Uninitiaze the hash module
Returns:
void
Parameters:
hHash Handle on the hash module

GSbool UpdateHash GShandle  hHash,
const GSubyte *  pucInBuffer,
GSuint  uiBufferSize,
GSuint  uiIterations = 1
 

Description:
Update the internal hash context with the input value, the number of iteration can be modified to change the hashed output value, it represent the number of passed the input value is put through the hash algorithm. This function will return GS_FALSE if the hash context is already terminated.
Returns:
Status of the function call
Return values:
GS_TRUE the operation suceeded.
GS_FALSE the operation failed.
Parameters:
IN hHash Handle to the hash to be updated
IN pucInBuffer The input buffer to be hashed.
IN uiBufferSize The lenght of the input buffer.
IN uiIterations Nuber of time to hash the input value.


Ubi.com GameService SDK - ©UbiSoft Entertainment 2002
GameService development team