diff options
author | Rob Landley <rob@landley.net> | 2006-05-16 06:38:26 +0400 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-05-16 06:38:26 +0400 |
commit | 34b5319d86eb639794dcccc56a443e7a35daf5d3 (patch) | |
tree | e8a8ee0a912d46c699fab3b5fba67c33fcced333 /coreutils | |
parent | d272dc7cb306995c6a8ec78c13a4aa1021d33a53 (diff) |
Make md5 calculation always go through an the buffer so that A) we don't
handle packets out of sequence if some data goes through the buffer and
some doesn't, B) it works on systems that can't handle aligned access,
C) we just have one code path to worry about.
While we're at it, sizeof() and RESERVE_CONFIG_BUFFER() really don't combine
well, which is why md5sum has been reading and processing data 4 bytes at a
time. I suspect that the existence of CONFIG_MD5_SIZE_VS_SPEED to do loop
unrolling and such in the algorithm was an attempt to work around that bug.
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/md5_sha1_sum.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c index 633b6e534..eeee18449 100644 --- a/coreutils/md5_sha1_sum.c +++ b/coreutils/md5_sha1_sum.c @@ -71,7 +71,7 @@ static uint8_t *hash_file(const char *filename, hash_algo_t hash_algo) bb_error_msg_and_die("algorithm not supported"); } - while (0 < (count = read(src_fd, in_buf, sizeof in_buf))) { + while (0 < (count = read(src_fd, in_buf, 4096))) { update(in_buf, count, &context); } |