aboutsummaryrefslogtreecommitdiffstats
path: root/process.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 /process.c
parentFirst commit (diff)
downloadlibsha1-1.0.tar.gz
libsha1-1.0.tar.bz2
libsha1-1.0.tar.xz
Implement SHA-0 and remove .chunk_size1.0
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'process.c')
-rw-r--r--process.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/process.c b/process.c
index ce5a043..d328bac 100644
--- a/process.c
+++ b/process.c
@@ -36,8 +36,13 @@ libsha1_process(struct libsha1_state *restrict state, const unsigned char *restr
state->w[i] |= (uint32_t)chunk[4 * i + 2] << 8;
state->w[i] |= (uint32_t)chunk[4 * i + 3];
}
- for (; i < 80; i++)
- state->w[i] = rorl(state->w[i - 3] ^ state->w[i - 8] ^ state->w[i - 14] ^ state->w[i - 16], 1);
+ if (state->algorithm == LIBSHA1_1) {
+ for (; i < 80; i++)
+ state->w[i] = rorl(state->w[i - 3] ^ state->w[i - 8] ^ state->w[i - 14] ^ state->w[i - 16], 1);
+ } else {
+ for (; i < 80; i++)
+ state->w[i] = state->w[i - 3] ^ state->w[i - 8] ^ state->w[i - 14] ^ state->w[i - 16];
+ }
a = state->h[0];
b = state->h[1];
c = state->h[2];