aboutsummaryrefslogtreecommitdiffstats
path: root/update.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2019-02-10 20:57:56 +0100
committerMattias Andrée <maandree@kth.se>2019-02-10 20:57:56 +0100
commit15f132722cae63775dd7b2fef866d477c54c7b8e (patch)
tree27359241e0a1a0b6f304060bc0a9e7c9287efd06 /update.c
parentFirst commit (diff)
downloadlibsha1-15f132722cae63775dd7b2fef866d477c54c7b8e.tar.gz
libsha1-15f132722cae63775dd7b2fef866d477c54c7b8e.tar.bz2
libsha1-15f132722cae63775dd7b2fef866d477c54c7b8e.tar.xz
Implement SHA-0 and remove .chunk_size1.0
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'update.c')
-rw-r--r--update.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/update.c b/update.c
index 7c9ed9b..1725eb8 100644
--- a/update.c
+++ b/update.c
@@ -15,23 +15,23 @@ libsha1_update(struct libsha1_state *restrict state, const void *restrict messag
const char *restrict message = message_;
size_t n, off;
- off = (state->message_size / 8) % state->chunk_size;
+ off = (state->message_size / 8) % sizeof(state->chunk);
state->message_size += msglen;
msglen /= 8;
if (off) {
- n = msglen < state->chunk_size - off ? msglen : state->chunk_size - off;
+ n = msglen < sizeof(state->chunk) - off ? msglen : sizeof(state->chunk) - off;
memcpy(state->chunk + off, message, n);
- if (off + n == state->chunk_size)
+ if (off + n == sizeof(state->chunk))
libsha1_process(state, state->chunk);
message += n;
msglen -= n;
}
- while (msglen >= state->chunk_size) {
+ while (msglen >= sizeof(state->chunk)) {
libsha1_process(state, (const unsigned char *)message);
- message += state->chunk_size;
- msglen -= state->chunk_size;
+ message += sizeof(state->chunk);
+ msglen -= sizeof(state->chunk);
}
if (msglen)