diff options
author | Mattias Andrée <maandree@kth.se> | 2019-02-10 15:58:27 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2019-02-10 15:58:27 +0100 |
commit | 6b7209128ee0a7aa22126ed7f4cc3d0c2fee267b (patch) | |
tree | 05bea4079bdd0ebc5f0dba72ac77dd568f40d8f4 /digest.c | |
parent | Minor fixes and tests (diff) | |
download | libsha2-6b7209128ee0a7aa22126ed7f4cc3d0c2fee267b.tar.gz libsha2-6b7209128ee0a7aa22126ed7f4cc3d0c2fee267b.tar.bz2 libsha2-6b7209128ee0a7aa22126ed7f4cc3d0c2fee267b.tar.xz |
Use lowest bits rather than highest bits in complete byte, document this, and add tests
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'digest.c')
-rw-r--r-- | digest.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -24,6 +24,7 @@ libsha2_digest(struct libsha2_state *restrict state, const char *message, size_t off = (state->message_size / 8) % state->chunk_size; if (msglen) { state->chunk[off] = (unsigned char)*message; + state->chunk[off] <<= 8 - msglen; state->chunk[off] |= (unsigned char)(1 << (7 - msglen)); state->chunk[off] &= (unsigned char)~((1 << (7 - msglen)) - 1); state->message_size += msglen; |