diff options
author | Mattias Andrée <maandree@kth.se> | 2019-02-10 20:57:56 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2019-02-10 20:57:56 +0100 |
commit | 15f132722cae63775dd7b2fef866d477c54c7b8e (patch) | |
tree | 27359241e0a1a0b6f304060bc0a9e7c9287efd06 /update.c | |
parent | First commit (diff) | |
download | libsha1-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 '')
-rw-r--r-- | update.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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) |