diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-06-24 08:56:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-06-24 08:59:34 +0300 |
commit | 4b9ff3cd42be427e478743648e9951bf8c189a04 (patch) | |
tree | b0cb1462a8fdae38df4a0a1067349f3118d56a43 /source/blender/blenlib/intern/hash_md5.c | |
parent | 2e99a74df9ecfa18c4081cdcc82227e2e24f14b1 (diff) |
Cleanup: comment blocks, trailing space in comments
Diffstat (limited to 'source/blender/blenlib/intern/hash_md5.c')
-rw-r--r-- | source/blender/blenlib/intern/hash_md5.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/source/blender/blenlib/intern/hash_md5.c b/source/blender/blenlib/intern/hash_md5.c index 8c869ce28c3..3db1b7df0fa 100644 --- a/source/blender/blenlib/intern/hash_md5.c +++ b/source/blender/blenlib/intern/hash_md5.c @@ -92,7 +92,7 @@ struct md5_ctx { /* This array contains the bytes used to pad the buffer to the next 64-byte boundary. * (RFC 1321, 3.1: Step 1) */ -static const unsigned char fillbuf[64] = {0x80, 0 /* , 0, 0, ... */}; +static const unsigned char fillbuf[64] = {0x80, 0 /* , 0, 0, ... */}; /** * Initialize structure containing state of computation. @@ -136,7 +136,7 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct md5_uint32 C = ctx->C; md5_uint32 D = ctx->D; - /* Process all bytes in the buffer with 64 bytes in each round of the loop. */ + /* Process all bytes in the buffer with 64 bytes in each round of the loop. */ while (words < endp) { md5_uint32 *cwp = correct_words; md5_uint32 A_save = A; @@ -161,7 +161,7 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct * T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64 */ - /* Round 1. */ + /* Round 1. */ OP(A, B, C, D, 7, 0xd76aa478); OP(D, A, B, C, 12, 0xe8c7b756); OP(C, D, A, B, 17, 0x242070db); @@ -190,7 +190,7 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct a += b; \ (void)0 - /* Round 2. */ + /* Round 2. */ OP(FG, A, B, C, D, 1, 5, 0xf61e2562); OP(FG, D, A, B, C, 6, 9, 0xc040b340); OP(FG, C, D, A, B, 11, 14, 0x265e5a51); @@ -208,7 +208,7 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct OP(FG, C, D, A, B, 7, 14, 0x676f02d9); OP(FG, B, C, D, A, 12, 20, 0x8d2a4c8a); - /* Round 3. */ + /* Round 3. */ OP(FH, A, B, C, D, 5, 4, 0xfffa3942); OP(FH, D, A, B, C, 8, 11, 0x8771f681); OP(FH, C, D, A, B, 11, 16, 0x6d9d6122); @@ -226,7 +226,7 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct OP(FH, C, D, A, B, 15, 16, 0x1fa27cf8); OP(FH, B, C, D, A, 2, 23, 0xc4ac5665); - /* Round 4. */ + /* Round 4. */ OP(FI, A, B, C, D, 0, 6, 0xf4292244); OP(FI, D, A, B, C, 7, 10, 0x432aff97); OP(FI, C, D, A, B, 14, 15, 0xab9423a7); @@ -246,14 +246,14 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct #undef OP - /* Add the starting values of the context. */ + /* Add the starting values of the context. */ A += A_save; B += B_save; C += C_save; D += D_save; } - /* Put checksum in context given as argument. */ + /* Put checksum in context given as argument. */ ctx->A = A; ctx->B = B; ctx->C = C; @@ -330,7 +330,7 @@ int BLI_hash_md5_stream(FILE *stream, void *resblock) ++len[1]; } - /* If end of file is reached, end the loop. */ + /* If end of file is reached, end the loop. */ if (n == 0) { break; } @@ -354,10 +354,10 @@ int BLI_hash_md5_stream(FILE *stream, void *resblock) *(md5_uint32 *)&buffer[sum + pad] = SWAP(len[0] << 3); *(md5_uint32 *)&buffer[sum + pad + 4] = SWAP((len[1] << 3) | (len[0] >> 29)); - /* Process last bytes. */ + /* Process last bytes. */ md5_process_block(buffer, sum + pad + 8, &ctx); - /* Construct result in desired memory. */ + /* Construct result in desired memory. */ md5_read_ctx(&ctx, resblock); return 0; } @@ -374,15 +374,15 @@ void *BLI_hash_md5_buffer(const char *buffer, size_t len, void *resblock) size_t blocks = len & ~63; size_t pad, rest; - /* Initialize the computation context. */ + /* Initialize the computation context. */ md5_init_ctx(&ctx); - /* Process whole buffer but last len % 64 bytes. */ + /* Process whole buffer but last len % 64 bytes. */ md5_process_block(buffer, blocks, &ctx); - /* REST bytes are not processed yet. */ + /* REST bytes are not processed yet. */ rest = len - blocks; - /* Copy to own buffer. */ + /* Copy to own buffer. */ memcpy(restbuf, &buffer[blocks], rest); /* Append needed fill bytes at end of buffer. * We can copy 64 bytes because the buffer is always big enough. */ |