From a265d4c4c790c442af8760345bcade8181f5d1a4 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 9 Feb 2019 21:07:38 +0100 Subject: Fix documentation about lengths (in bits, not bytes) and fix libsha2_sum_fd (lengths are in bits) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- TODO | 1 - libsha2_digest.3 | 5 +++-- libsha2_sum_fd.3 | 2 +- libsha2_update.3 | 3 ++- sum_fd.c | 3 +-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/TODO b/TODO index 094220e..0087301 100644 --- a/TODO +++ b/TODO @@ -1,2 +1 @@ Add HMAC support -Add bit support diff --git a/libsha2_digest.3 b/libsha2_digest.3 index 2e7d31e..fd4e0ad 100644 --- a/libsha2_digest.3 +++ b/libsha2_digest.3 @@ -15,14 +15,15 @@ The .BR libsha2_digest () function feeds the first .I msglen -bytes of +.B bits +of .I message into the hashing state of the .I state parameter, and finalises the hashing. The resulting hash is stored in binary format in -.I output . +.IR output . The user must make sure that .I output is sufficiently large, which means at diff --git a/libsha2_sum_fd.3 b/libsha2_sum_fd.3 index 18e9291..82bff15 100644 --- a/libsha2_sum_fd.3 +++ b/libsha2_sum_fd.3 @@ -29,7 +29,7 @@ with the selected .IR algorithm . The resulting hash is stored in binary format in -.I hashsum . +.IR hashsum . The user must make sure that .I hashsum is sufficiently large, which means at diff --git a/libsha2_update.3 b/libsha2_update.3 index c504b76..fe82384 100644 --- a/libsha2_update.3 +++ b/libsha2_update.3 @@ -15,7 +15,8 @@ The .BR libsha2_update () function feeds the first .I msglen -bytes of +.B bits +(must equivalent to 0 modulus 8) of .I message into the hashing state of the .I state diff --git a/sum_fd.c b/sum_fd.c index 35d4121..888e423 100644 --- a/sum_fd.c +++ b/sum_fd.c @@ -37,10 +37,9 @@ libsha2_sum_fd(int fd, enum libsha2_algorithm algorithm, char *restrict hashsum) continue; return -1; } - libsha2_update(&state, chunk, (size_t)r); + libsha2_update(&state, chunk, (size_t)r * 8); } libsha2_digest(&state, NULL, 0, hashsum); return 0; } - -- cgit v1.2.3-70-g09d2