#include "mchecksum_config.h"
Go to the source code of this file.
#define MCHECKSUM_NOFINALIZE 0 |
#define MCHECKSUM_FINALIZE 1 |
MCHECKSUM_EXPORT int mchecksum_init |
( |
const char * |
hash_method, |
|
|
mchecksum_object_t * |
checksum |
|
) |
| |
Initialize the checksum with the specified hash method.
- Parameters
-
hash_method | [IN] hash method string Available methods are: "crc16", "crc64" |
checksum | [OUT] pointer to abstract checksum |
- Returns
- Non-negative on success or negative on failure
Destroy the checksum.
- Parameters
-
checksum | [IN/OUT] abstract checksum |
- Returns
- Non-negative on success or negative on failure
Reset the checksum.
- Parameters
-
checksum | [IN/OUT] abstract checksum |
- Returns
- Non-negative on success or negative on failure
Get size of checksum.
- Parameters
-
checksum | [IN] abstract checksum |
- Returns
- Non-negative value
MCHECKSUM_EXPORT int mchecksum_get |
( |
mchecksum_object_t |
checksum, |
|
|
void * |
buf, |
|
|
size_t |
size, |
|
|
int |
finalize |
|
) |
| |
Get checksum and copy it into buf.
- Parameters
-
checksum | [IN/OUT] abstract checksum |
buf | [IN] pointer to buffer |
size | [IN] size of buffer |
finalize | [IN] one of: MCHECKSUM_FINALIZE no more data will be added to this checksum (only valid call to follow is reset or destroy) MCHECKSUM_NOFINALIZE More data might be added to this checksum later |
- Returns
- Non-negative on success or negative on failure
MCHECKSUM_EXPORT int mchecksum_update |
( |
mchecksum_object_t |
checksum, |
|
|
const void * |
data, |
|
|
size_t |
size |
|
) |
| |
Accumulates a partial checksum of the input data.
- Parameters
-
checksum | [IN/OUT] abstract checksum |
data | [IN] pointer to buffer |
size | [IN] size of buffer |
- Returns
- Non-negative on success or negative on failure