From 68a0e2cb28663b5dc10c5283d5dd74544d55138a Mon Sep 17 00:00:00 2001 From: Magnus Lundborg Date: Thu, 13 Jun 2013 11:14:47 +0200 Subject: (Re)change names of tng_md5_* to md5_* In order to make it work with existing md5 include files custom names should not be used. diff --git a/include/md5.h b/include/md5.h index d618489..5aef902 100644 --- a/include/md5.h +++ b/include/md5.h @@ -89,13 +89,13 @@ extern "C" #endif /* DECLSPECDLLEXPORT */ /* Initialize the algorithm. */ -void DECLSPECDLLEXPORT tng_md5_init(md5_state_t *pms); +void DECLSPECDLLEXPORT md5_init(md5_state_t *pms); /* Append a string to the message. */ -void DECLSPECDLLEXPORT tng_md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); +void DECLSPECDLLEXPORT md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); /* Finish the message and return the digest. */ -void DECLSPECDLLEXPORT tng_md5_finish(md5_state_t *pms, md5_byte_t digest[16]); +void DECLSPECDLLEXPORT md5_finish(md5_state_t *pms, md5_byte_t digest[16]); #ifdef __cplusplus } /* end extern "C" */ diff --git a/include/tng_io.h b/include/tng_io.h index c7cb9ba..df99d52 100644 --- a/include/tng_io.h +++ b/include/tng_io.h @@ -119,7 +119,7 @@ * * @subsection c_subsec C * - * Example writing data to a TNG file (just an extract): + * Example writing data to a TNG file (just an excerpt): * \code * for ( step = 1; step < step_num; step++ ) * { diff --git a/src/lib/md5.c b/src/lib/md5.c index 8bd79b9..896bf68 100644 --- a/src/lib/md5.c +++ b/src/lib/md5.c @@ -364,7 +364,7 @@ md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) } void DECLSPECDLLEXPORT -tng_md5_init(md5_state_t *pms) +md5_init(md5_state_t *pms) { pms->count[0] = pms->count[1] = 0; pms->abcd[0] = 0x67452301; @@ -374,7 +374,7 @@ tng_md5_init(md5_state_t *pms) } void DECLSPECDLLEXPORT -tng_md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes) +md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes) { const md5_byte_t *p = data; int left = nbytes; @@ -412,7 +412,7 @@ tng_md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes) } void DECLSPECDLLEXPORT -tng_md5_finish(md5_state_t *pms, md5_byte_t digest[16]) +md5_finish(md5_state_t *pms, md5_byte_t digest[16]) { static const md5_byte_t pad[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -427,9 +427,9 @@ tng_md5_finish(md5_state_t *pms, md5_byte_t digest[16]) for (i = 0; i < 8; ++i) data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3)); /* Pad to 56 bytes mod 64. */ - tng_md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1); + md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1); /* Append the length. */ - tng_md5_append(pms, data, 8); + md5_append(pms, data, 8); for (i = 0; i < 16; ++i) digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3)); } diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c index 478c804..03baf21 100644 --- a/src/lib/tng_io.c +++ b/src/lib/tng_io.c @@ -587,10 +587,10 @@ static tng_function_status tng_block_hash_generate(tng_gen_block_t block) { md5_state_t md5_state; - tng_md5_init(&md5_state); - tng_md5_append(&md5_state, (md5_byte_t *)block->block_contents, + md5_init(&md5_state); + md5_append(&md5_state, (md5_byte_t *)block->block_contents, block->block_contents_size); - tng_md5_finish(&md5_state, (md5_byte_t *)block->hash); + md5_finish(&md5_state, (md5_byte_t *)block->hash); return(TNG_SUCCESS); } @@ -615,10 +615,10 @@ static tng_function_status hash_match_verify(tng_gen_block_t block, *results = TNG_TRUE; return(TNG_FAILURE); } - tng_md5_init(&md5_state); - tng_md5_append(&md5_state, (md5_byte_t *)block->block_contents, + md5_init(&md5_state); + md5_append(&md5_state, (md5_byte_t *)block->block_contents, block->block_contents_size); - tng_md5_finish(&md5_state, (md5_byte_t *)hash); + md5_finish(&md5_state, (md5_byte_t *)hash); if(strncmp(block->hash, hash, 16) != 0) { -- cgit v0.10.1