INNER CODE UNIT · C

last_chunk_size

amosnier/sha-2 · test.c:140

		const size_t last_chunk_size = len % num_chunks;
		const uint8_t *p = input;
		while (num_chunks-- > 0) {
			sha_256_write(&sha_256, p, chunk_size);
			p += chunk_size;
		}
		sha_256_write(&sha_256, p, last_chunk_size);
	}

	(void)sha_256_close(&sha_256);
}
#endif

/*
 * Limitation:
 * - The variable input_len will be truncated to its LONG_BIT least significant bits in the print output. This will
 *   never be a problem for values that in practice are less than 2^32 - 1. Rationale: ANSI C-compatibility and keeping
 *   it simple.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…