aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2024-09-06 20:00:21 +0200
committerMattias Andrée <maandree@kth.se>2024-09-06 20:00:21 +0200
commite08dff210507b3a56e8aa1cd14d653ecfb3228f9 (patch)
tree66771aef79dd8e5da0d88035cf601d0219d7010d
parentDocument standard_partial_byte_{in,out}put_encoding in man pages (diff)
downloadlibhashsum-e08dff210507b3a56e8aa1cd14d653ecfb3228f9.tar.gz
libhashsum-e08dff210507b3a56e8aa1cd14d653ecfb3228f9.tar.bz2
libhashsum-e08dff210507b3a56e8aa1cd14d653ecfb3228f9.tar.xz
Add hash_excess_bits
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--Makefile2
-rw-r--r--libhashsum.h17
-rw-r--r--libhashsum_init_blake224_hasher.35
-rw-r--r--libhashsum_init_blake224_hasher.c1
-rw-r--r--libhashsum_init_blake256_hasher.35
-rw-r--r--libhashsum_init_blake256_hasher.c1
-rw-r--r--libhashsum_init_blake2b_hasher.35
-rw-r--r--libhashsum_init_blake2b_hasher.c1
-rw-r--r--libhashsum_init_blake2s_hasher.35
-rw-r--r--libhashsum_init_blake2s_hasher.c1
-rw-r--r--libhashsum_init_blake384_hasher.35
-rw-r--r--libhashsum_init_blake384_hasher.c1
-rw-r--r--libhashsum_init_blake512_hasher.35
-rw-r--r--libhashsum_init_blake512_hasher.c1
-rw-r--r--libhashsum_init_blake_hasher.35
-rw-r--r--libhashsum_init_blakeb_hasher.35
-rw-r--r--libhashsum_init_blakes_hasher.35
-rw-r--r--libhashsum_init_hasher.36
-rw-r--r--libhashsum_init_hasher_from_string.36
-rw-r--r--libhashsum_init_keccak_224_hasher.35
-rw-r--r--libhashsum_init_keccak_256_hasher.35
-rw-r--r--libhashsum_init_keccak_384_hasher.35
-rw-r--r--libhashsum_init_keccak_512_hasher.35
-rw-r--r--libhashsum_init_keccak__.c1
-rw-r--r--libhashsum_init_keccak_hasher.311
-rw-r--r--libhashsum_init_md2_hasher.35
-rw-r--r--libhashsum_init_md2_hasher.c1
-rw-r--r--libhashsum_init_md4_hasher.35
-rw-r--r--libhashsum_init_md4_hasher.c1
-rw-r--r--libhashsum_init_md5_hasher.35
-rw-r--r--libhashsum_init_md5_hasher.c1
-rw-r--r--libhashsum_init_rawshake128_hasher.311
-rw-r--r--libhashsum_init_rawshake256_hasher.311
-rw-r--r--libhashsum_init_rawshake512_hasher.311
-rw-r--r--libhashsum_init_rawshake_hasher.313
-rw-r--r--libhashsum_init_ripemd_128_hasher.35
-rw-r--r--libhashsum_init_ripemd_128_hasher.c1
-rw-r--r--libhashsum_init_ripemd_160_hasher.35
-rw-r--r--libhashsum_init_ripemd_160_hasher.c1
-rw-r--r--libhashsum_init_ripemd_256_hasher.35
-rw-r--r--libhashsum_init_ripemd_256_hasher.c1
-rw-r--r--libhashsum_init_ripemd_320_hasher.35
-rw-r--r--libhashsum_init_ripemd_320_hasher.c1
-rw-r--r--libhashsum_init_sha0_hasher.35
-rw-r--r--libhashsum_init_sha0_hasher.c1
-rw-r--r--libhashsum_init_sha1_hasher.35
-rw-r--r--libhashsum_init_sha1_hasher.c1
-rw-r--r--libhashsum_init_sha2_hasher.35
-rw-r--r--libhashsum_init_sha2_hasher.c1
-rw-r--r--libhashsum_init_sha3_224_hasher.35
-rw-r--r--libhashsum_init_sha3_256_hasher.35
-rw-r--r--libhashsum_init_sha3_384_hasher.35
-rw-r--r--libhashsum_init_sha3_512_hasher.35
-rw-r--r--libhashsum_init_sha3_hasher.35
-rw-r--r--libhashsum_init_sha_224_hasher.35
-rw-r--r--libhashsum_init_sha_256_hasher.35
-rw-r--r--libhashsum_init_sha_384_hasher.35
-rw-r--r--libhashsum_init_sha_512_224_hasher.35
-rw-r--r--libhashsum_init_sha_512_256_hasher.35
-rw-r--r--libhashsum_init_sha_512_hasher.35
-rw-r--r--libhashsum_init_shake128_hasher.311
-rw-r--r--libhashsum_init_shake256_hasher.311
-rw-r--r--libhashsum_init_shake512_hasher.311
-rw-r--r--libhashsum_init_shake_hasher.313
64 files changed, 317 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index ecb36af..603e094 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@ include mk/after-config.mk
LIB_MAJOR = 1
-LIB_MINOR = 0
+LIB_MINOR = 1
LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR)
LIB_NAME = hashsum
diff --git a/libhashsum.h b/libhashsum.h
index 6ac9fc8..ea31b9d 100644
--- a/libhashsum.h
+++ b/libhashsum.h
@@ -340,7 +340,7 @@ enum {
/**
* Message hash functions and state
*
- * @since 1.0
+ * @since 1.0, 1.1
*/
struct libhashsum_hasher {
/**
@@ -466,6 +466,21 @@ struct libhashsum_hasher {
unsigned char standard_partial_byte_output_encoding; /* TODO test */
/**
+ * The size of the hash is rounded up to whole octet in
+ * `.hash_size`, in the case that the hash size is not
+ * a while number of octets, the returned hash will be
+ * padded, on the most significant part of the last byte,
+ * with cleared bits. This fields specifies the number
+ * of pad bits, which is always 0 if for hash functions
+ * that only support whole octet hash sizes (most of them;
+ * when `.standard_partial_byte_output_encoding` is set
+ * to `LIBHASHSUM_UNSUPPORTED`)
+ *
+ * @since 1.1
+ */
+ unsigned char hash_excess_bits; /* TODO test */
+
+ /**
* Update the hash state given additional
* input data
*
diff --git a/libhashsum_init_blake224_hasher.3 b/libhashsum_init_blake224_hasher.3
index ffdefe4..2de8929 100644
--- a/libhashsum_init_blake224_hasher.3
+++ b/libhashsum_init_blake224_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_blake224_hasher - initialise state for BLAKE224 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -73,6 +74,10 @@ will be set to the block size BLAKE224 uses, in bytes.
will be set to the size of BLAKE224 hashes, in bytes
.RI ( LIBHASHSUM_BLAKE224_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_blake224_hasher.c b/libhashsum_init_blake224_hasher.c
index 1bd9103..b78b12a 100644
--- a/libhashsum_init_blake224_hasher.c
+++ b/libhashsum_init_blake224_hasher.c
@@ -107,6 +107,7 @@ libhashsum_init_blake224_hasher(struct libhashsum_hasher *this, const void *salt
this->supports_non_whole_bytes = 1;
this->standard_partial_byte_input_encoding = LIBHASHSUM_MOST_SIGNIFICANT;
this->standard_partial_byte_output_encoding = LIBHASHSUM_UNSUPPORTED;
+ this->hash_excess_bits = 0;
this->process = &process;
this->finalise_const = &finalise_const;
this->finalise = &finalise;
diff --git a/libhashsum_init_blake256_hasher.3 b/libhashsum_init_blake256_hasher.3
index 86df6df..2e78cde 100644
--- a/libhashsum_init_blake256_hasher.3
+++ b/libhashsum_init_blake256_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_blake256_hasher - initialise state for BLAKE256 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -73,6 +74,10 @@ will be set to the block size BLAKE256 uses, in bytes.
will be set to the size of BLAKE256 hashes, in bytes
.RI ( LIBHASHSUM_BLAKE256_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_blake256_hasher.c b/libhashsum_init_blake256_hasher.c
index 2dc9c8c..1b89eb2 100644
--- a/libhashsum_init_blake256_hasher.c
+++ b/libhashsum_init_blake256_hasher.c
@@ -107,6 +107,7 @@ libhashsum_init_blake256_hasher(struct libhashsum_hasher *this, const void *salt
this->supports_non_whole_bytes = 1;
this->standard_partial_byte_input_encoding = LIBHASHSUM_MOST_SIGNIFICANT;
this->standard_partial_byte_output_encoding = LIBHASHSUM_UNSUPPORTED;
+ this->hash_excess_bits = 0;
this->process = &process;
this->finalise_const = &finalise_const;
this->finalise = &finalise;
diff --git a/libhashsum_init_blake2b_hasher.3 b/libhashsum_init_blake2b_hasher.3
index 70bb571..6e2969b 100644
--- a/libhashsum_init_blake2b_hasher.3
+++ b/libhashsum_init_blake2b_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_blake2b_hasher - initialise state for BLAKE2b hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -132,6 +133,10 @@ unless
.I LIBHASHSUM_BLAKE2B_HASH_SIZE
otherwise.
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_blake2b_hasher.c b/libhashsum_init_blake2b_hasher.c
index 4172001..9a78419 100644
--- a/libhashsum_init_blake2b_hasher.c
+++ b/libhashsum_init_blake2b_hasher.c
@@ -169,6 +169,7 @@ libhashsum_init_blake2b_hasher(struct libhashsum_hasher *this, size_t hashbits,
this->supports_non_whole_bytes = 0;
this->standard_partial_byte_input_encoding = LIBHASHSUM_UNSUPPORTED;
this->standard_partial_byte_output_encoding = LIBHASHSUM_UNSUPPORTED;
+ this->hash_excess_bits = 0;
this->process = &process;
this->finalise_const = &finalise_const;
this->finalise = &finalise;
diff --git a/libhashsum_init_blake2s_hasher.3 b/libhashsum_init_blake2s_hasher.3
index 4f97f08..aee2c38 100644
--- a/libhashsum_init_blake2s_hasher.3
+++ b/libhashsum_init_blake2s_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_blake2s_hasher - initialise state for BLAKE2s hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -132,6 +133,10 @@ unless
.I LIBHASHSUM_BLAKE2S_HASH_SIZE
otherwise.
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_blake2s_hasher.c b/libhashsum_init_blake2s_hasher.c
index c2a2f37..7758006 100644
--- a/libhashsum_init_blake2s_hasher.c
+++ b/libhashsum_init_blake2s_hasher.c
@@ -169,6 +169,7 @@ libhashsum_init_blake2s_hasher(struct libhashsum_hasher *this, size_t hashbits,
this->supports_non_whole_bytes = 0;
this->standard_partial_byte_input_encoding = LIBHASHSUM_UNSUPPORTED;
this->standard_partial_byte_output_encoding = LIBHASHSUM_UNSUPPORTED;
+ this->hash_excess_bits = 0;
this->process = &process;
this->finalise_const = &finalise_const;
this->finalise = &finalise;
diff --git a/libhashsum_init_blake384_hasher.3 b/libhashsum_init_blake384_hasher.3
index 3e72083..1b81266 100644
--- a/libhashsum_init_blake384_hasher.3
+++ b/libhashsum_init_blake384_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_blake384_hasher - initialise state for BLAKE384 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -73,6 +74,10 @@ will be set to the block size BLAKE384 uses, in bytes.
will be set to the size of BLAKE384 hashes, in bytes
.RI ( LIBHASHSUM_BLAKE384_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_blake384_hasher.c b/libhashsum_init_blake384_hasher.c
index f1f32dc..a507593 100644
--- a/libhashsum_init_blake384_hasher.c
+++ b/libhashsum_init_blake384_hasher.c
@@ -107,6 +107,7 @@ libhashsum_init_blake384_hasher(struct libhashsum_hasher *this, const void *salt
this->supports_non_whole_bytes = 1;
this->standard_partial_byte_input_encoding = LIBHASHSUM_MOST_SIGNIFICANT;
this->standard_partial_byte_output_encoding = LIBHASHSUM_UNSUPPORTED;
+ this->hash_excess_bits = 0;
this->process = &process;
this->finalise_const = &finalise_const;
this->finalise = &finalise;
diff --git a/libhashsum_init_blake512_hasher.3 b/libhashsum_init_blake512_hasher.3
index 2e10d32..731a540 100644
--- a/libhashsum_init_blake512_hasher.3
+++ b/libhashsum_init_blake512_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_blake512_hasher - initialise state for BLAKE512 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -73,6 +74,10 @@ will be set to the block size BLAKE512 uses, in bytes.
will be set to the size of BLAKE512 hashes, in bytes
.RI ( LIBHASHSUM_BLAKE512_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_blake512_hasher.c b/libhashsum_init_blake512_hasher.c
index d9e3aca..b80d4e8 100644
--- a/libhashsum_init_blake512_hasher.c
+++ b/libhashsum_init_blake512_hasher.c
@@ -107,6 +107,7 @@ libhashsum_init_blake512_hasher(struct libhashsum_hasher *this, const void *salt
this->supports_non_whole_bytes = 1;
this->standard_partial_byte_input_encoding = LIBHASHSUM_MOST_SIGNIFICANT;
this->standard_partial_byte_output_encoding = LIBHASHSUM_UNSUPPORTED;
+ this->hash_excess_bits = 0;
this->process = &process;
this->finalise_const = &finalise_const;
this->finalise = &finalise;
diff --git a/libhashsum_init_blake_hasher.3 b/libhashsum_init_blake_hasher.3
index 8a2fcd3..bdb09b1 100644
--- a/libhashsum_init_blake_hasher.3
+++ b/libhashsum_init_blake_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_blake_hasher - initialise state for BLAKE hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -105,6 +106,10 @@ will be set to the block size BLAKE uses, in bytes.
will be set to the hash size, in bytes
.RI ( hashbits/8 ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_blakeb_hasher.3 b/libhashsum_init_blakeb_hasher.3
index ded8687..b5c96f1 100644
--- a/libhashsum_init_blakeb_hasher.3
+++ b/libhashsum_init_blakeb_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_blakeb_hasher - initialise state for BLAKEb hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -82,6 +83,10 @@ will be set to the block size BLAKEb uses, in bytes.
will be set to the hash size, in bytes
.RI ( hashbits/8 ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_blakes_hasher.3 b/libhashsum_init_blakes_hasher.3
index 0c604f2..e8067f5 100644
--- a/libhashsum_init_blakes_hasher.3
+++ b/libhashsum_init_blakes_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_blakes_hasher - initialise state for BLAKEs hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -82,6 +83,10 @@ will be set to the block size BLAKEs uses, in bytes.
will be set to the hash size, in bytes
.RI ( hashbits/8 ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_hasher.3 b/libhashsum_init_hasher.3
index 5bb2b62..6e07a79 100644
--- a/libhashsum_init_hasher.3
+++ b/libhashsum_init_hasher.3
@@ -17,6 +17,7 @@ libhashsum_init_hasher - initialise state for hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -260,6 +261,11 @@ will be set to the block size, in bytes.
.I hasher->hash_size
will be set to the hash size, in bytes.
.PP
+.I hasher->hash_excess_bits
+will be set to number of bits the last byte in
+the hash is padded with (it will be padded with
+cleared bits in its most significant part).
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_hasher_from_string.3 b/libhashsum_init_hasher_from_string.3
index bc0cb4a..1619b49 100644
--- a/libhashsum_init_hasher_from_string.3
+++ b/libhashsum_init_hasher_from_string.3
@@ -15,6 +15,7 @@ libhashsum_init_hasher_from_string - initialise state for hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -79,6 +80,11 @@ will be set to the block size, in bytes.
.I hasher->hash_size
will be set to the hash size, in bytes.
.PP
+.I hasher->hash_excess_bits
+will be set to number of bits the last byte in
+the hash is padded with (it will be padded with
+cleared bits in its most significant part).
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_keccak_224_hasher.3 b/libhashsum_init_keccak_224_hasher.3
index 3252f86..c040318 100644
--- a/libhashsum_init_keccak_224_hasher.3
+++ b/libhashsum_init_keccak_224_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_keccak_224_hasher - initialise state for Keccak-224 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -56,6 +57,10 @@ will be set to the block size Keccak-224 uses, in bytes.
will be set to the size of Keccak-224 hashes, in bytes
.RI ( LIBHASHSUM_KECCAK_224_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_keccak_256_hasher.3 b/libhashsum_init_keccak_256_hasher.3
index ce87a81..a4f7822 100644
--- a/libhashsum_init_keccak_256_hasher.3
+++ b/libhashsum_init_keccak_256_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_keccak_256_hasher - initialise state for Keccak-256 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -56,6 +57,10 @@ will be set to the block size Keccak-256 uses, in bytes.
will be set to the size of Keccak-256 hashes, in bytes
.RI ( LIBHASHSUM_KECCAK_256_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_keccak_384_hasher.3 b/libhashsum_init_keccak_384_hasher.3
index a17d2f7..b4c6021 100644
--- a/libhashsum_init_keccak_384_hasher.3
+++ b/libhashsum_init_keccak_384_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_keccak_384_hasher - initialise state for Keccak-384 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -56,6 +57,10 @@ will be set to the block size Keccak-384 uses, in bytes.
will be set to the size of Keccak-384 hashes, in bytes
.RI ( LIBHASHSUM_KECCAK_384_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_keccak_512_hasher.3 b/libhashsum_init_keccak_512_hasher.3
index c175413..a9c6eca 100644
--- a/libhashsum_init_keccak_512_hasher.3
+++ b/libhashsum_init_keccak_512_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_keccak_512_hasher - initialise state for Keccak-512 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -56,6 +57,10 @@ will be set to the block size Keccak-512 uses, in bytes.
will be set to the size of Keccak-512 hashes, in bytes
.RI ( LIBHASHSUM_KECCAK_512_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_keccak__.c b/libhashsum_init_keccak__.c
index 6e1abf7..f9c8be1 100644
--- a/libhashsum_init_keccak__.c
+++ b/libhashsum_init_keccak__.c
@@ -151,6 +151,7 @@ libhashsum_init_keccak__(struct libhashsum_hasher *this, size_t hashbits, void *
this->supports_non_whole_bytes = 1;
this->standard_partial_byte_input_encoding = LIBHASHSUM_LEAST_SIGNIFICANT;
this->standard_partial_byte_output_encoding = LIBHASHSUM_LEAST_SIGNIFICANT;
+ this->hash_excess_bits = (8U - (hashbits & 7U)) & 7U;
this->state.keccak.squeezes = squeezes;
this->state.keccak.suffix = suffix;
diff --git a/libhashsum_init_keccak_hasher.3 b/libhashsum_init_keccak_hasher.3
index b342662..272ed19 100644
--- a/libhashsum_init_keccak_hasher.3
+++ b/libhashsum_init_keccak_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_keccak_hasher - initialise state for Keccak hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -136,6 +137,16 @@ will be set to the hash size, in bytes
unless
.IR hashbits==0 ).
.PP
+.I hasher->hash_excess_bits
+will be set to number of bits the last byte in
+the hash is padded with (it will be padded with
+cleared bits in its most significant part). As
+long as
+.I hashbits
+is a multiple of 8, this number will be 0 (the
+entire last byte is used), otherwise, it will be
+.IR 8-(hashbits&7) .
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_md2_hasher.3 b/libhashsum_init_md2_hasher.3
index 51a388f..4229718 100644
--- a/libhashsum_init_md2_hasher.3
+++ b/libhashsum_init_md2_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_md2_hasher - initialise state for MD2 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -53,6 +54,10 @@ will be set to the block size MD2 uses, in bytes.
will be set to the size of MD2 hashes, in bytes
.RI ( LIBHASHSUM_MD2_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_md2_hasher.c b/libhashsum_init_md2_hasher.c
index a30ede8..2fb1668 100644
--- a/libhashsum_init_md2_hasher.c
+++ b/libhashsum_init_md2_hasher.c
@@ -141,6 +141,7 @@ libhashsum_init_md2_hasher(struct libhashsum_hasher *this)
this->supports_non_whole_bytes = 0;
this->standard_partial_byte_input_encoding = LIBHASHSUM_UNSUPPORTED;
this->standard_partial_byte_output_encoding = LIBHASHSUM_UNSUPPORTED;
+ this->hash_excess_bits = 0;
this->process = &process;
this->finalise_const = &finalise_const;
this->finalise = &finalise;
diff --git a/libhashsum_init_md4_hasher.3 b/libhashsum_init_md4_hasher.3
index 8f752e2..409d71f 100644
--- a/libhashsum_init_md4_hasher.3
+++ b/libhashsum_init_md4_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_md4_hasher - initialise state for MD4 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -53,6 +54,10 @@ will be set to the block size MD4 uses, in bytes.
will be set to the size of MD4 hashes, in bytes
.RI ( LIBHASHSUM_MD4_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_md4_hasher.c b/libhashsum_init_md4_hasher.c
index 2b6e607..d5f7876 100644
--- a/libhashsum_init_md4_hasher.c
+++ b/libhashsum_init_md4_hasher.c
@@ -186,6 +186,7 @@ libhashsum_init_md4_hasher(struct libhashsum_hasher *this)
this->supports_non_whole_bytes = 1;
this->standard_partial_byte_input_encoding = LIBHASHSUM_MOST_SIGNIFICANT;
this->standard_partial_byte_output_encoding = LIBHASHSUM_UNSUPPORTED;
+ this->hash_excess_bits = 0;
this->process = &process;
this->finalise_const = &finalise_const;
this->finalise = &finalise;
diff --git a/libhashsum_init_md5_hasher.3 b/libhashsum_init_md5_hasher.3
index 6b3365f..276953e 100644
--- a/libhashsum_init_md5_hasher.3
+++ b/libhashsum_init_md5_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_md5_hasher - initialise state for MD5 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -53,6 +54,10 @@ will be set to the block size MD5 uses, in bytes.
will be set to the size of MD5 hashes, in bytes
.RI ( LIBHASHSUM_MD5_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_md5_hasher.c b/libhashsum_init_md5_hasher.c
index 00cb81a..737bb49 100644
--- a/libhashsum_init_md5_hasher.c
+++ b/libhashsum_init_md5_hasher.c
@@ -201,6 +201,7 @@ libhashsum_init_md5_hasher(struct libhashsum_hasher *this)
this->supports_non_whole_bytes = 1;
this->standard_partial_byte_input_encoding = LIBHASHSUM_MOST_SIGNIFICANT;
this->standard_partial_byte_output_encoding = LIBHASHSUM_UNSUPPORTED;
+ this->hash_excess_bits = 0;
this->process = &process;
this->finalise_const = &finalise_const;
this->finalise = &finalise;
diff --git a/libhashsum_init_rawshake128_hasher.3 b/libhashsum_init_rawshake128_hasher.3
index d180c57..de789c3 100644
--- a/libhashsum_init_rawshake128_hasher.3
+++ b/libhashsum_init_rawshake128_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_rawshake128_hasher - initialise state for RawSHAKE128 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -76,6 +77,16 @@ if
.I hashbits
is 0 or 128).
.PP
+.I hasher->hash_excess_bits
+will be set to number of bits the last byte in
+the hash is padded with (it will be padded with
+cleared bits in its most significant part). As
+long as
+.I hashbits
+is a multiple of 8, this number will be 0 (the
+entire last byte is used), otherwise, it will be
+.IR 8-(hashbits&7) .
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_rawshake256_hasher.3 b/libhashsum_init_rawshake256_hasher.3
index 57bca9e..bb0ad79 100644
--- a/libhashsum_init_rawshake256_hasher.3
+++ b/libhashsum_init_rawshake256_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_rawshake256_hasher - initialise state for RawSHAKE256 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -76,6 +77,16 @@ if
.I hashbits
is 0 or 256).
.PP
+.I hasher->hash_excess_bits
+will be set to number of bits the last byte in
+the hash is padded with (it will be padded with
+cleared bits in its most significant part). As
+long as
+.I hashbits
+is a multiple of 8, this number will be 0 (the
+entire last byte is used), otherwise, it will be
+.IR 8-(hashbits&7) .
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_rawshake512_hasher.3 b/libhashsum_init_rawshake512_hasher.3
index 4f5b252..32bda1d 100644
--- a/libhashsum_init_rawshake512_hasher.3
+++ b/libhashsum_init_rawshake512_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_rawshake512_hasher - initialise state for RawSHAKE512 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -76,6 +77,16 @@ if
.I hashbits
is 0 or 512).
.PP
+.I hasher->hash_excess_bits
+will be set to number of bits the last byte in
+the hash is padded with (it will be padded with
+cleared bits in its most significant part). As
+long as
+.I hashbits
+is a multiple of 8, this number will be 0 (the
+entire last byte is used), otherwise, it will be
+.IR 8-(hashbits&7) .
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_rawshake_hasher.3 b/libhashsum_init_rawshake_hasher.3
index ac93630..1c73e5b 100644
--- a/libhashsum_init_rawshake_hasher.3
+++ b/libhashsum_init_rawshake_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_rawshake_hasher - initialise state for RawSHAKE hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -83,7 +84,17 @@ will be set to the block size, in bytes.
.PP
.I hasher->hash_size
will be set to the hash size, in bytes
-.RI ( (hashbits?hashbits:hcapbits)/8 ).
+.RI ( ((hashbits?hashbits:hcapbits)+7)/8 ).
+.PP
+.I hasher->hash_excess_bits
+will be set to number of bits the last byte in
+the hash is padded with (it will be padded with
+cleared bits in its most significant part). As
+long as
+.I hashbits
+is a multiple of 8, this number will be 0 (the
+entire last byte is used), otherwise, it will be
+.IR 8-(hashbits&7) .
.PP
.I hasher->hash_output
will be set to
diff --git a/libhashsum_init_ripemd_128_hasher.3 b/libhashsum_init_ripemd_128_hasher.3
index bdbc7e8..b45d491 100644
--- a/libhashsum_init_ripemd_128_hasher.3
+++ b/libhashsum_init_ripemd_128_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_ripemd_128_hasher - initialise state for RIPEMD-128 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -53,6 +54,10 @@ will be set to the block size RIPEMD-128 uses, in bytes.
will be set to the size of RIPEMD-128 hashes, in bytes
.RI ( LIBHASHSUM_RIPEMD_128_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_ripemd_128_hasher.c b/libhashsum_init_ripemd_128_hasher.c
index 2eb08da..e27f72a 100644
--- a/libhashsum_init_ripemd_128_hasher.c
+++ b/libhashsum_init_ripemd_128_hasher.c
@@ -222,6 +222,7 @@ libhashsum_init_ripemd_128_hasher(struct libhashsum_hasher *this)
this->supports_non_whole_bytes = 1;
this->standard_partial_byte_input_encoding = LIBHASHSUM_MOST_SIGNIFICANT;
this->standard_partial_byte_output_encoding = LIBHASHSUM_UNSUPPORTED;
+ this->hash_excess_bits = 0;
this->process = &process;
this->finalise_const = &finalise_const;
this->finalise = &finalise;
diff --git a/libhashsum_init_ripemd_160_hasher.3 b/libhashsum_init_ripemd_160_hasher.3
index 47d65c2..9ed4fb5 100644
--- a/libhashsum_init_ripemd_160_hasher.3
+++ b/libhashsum_init_ripemd_160_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_ripemd_160_hasher - initialise state for RIPEMD-160 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -53,6 +54,10 @@ will be set to the block size RIPEMD-160 uses, in bytes.
will be set to the size of RIPEMD-160 hashes, in bytes
.RI ( LIBHASHSUM_RIPEMD_160_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_ripemd_160_hasher.c b/libhashsum_init_ripemd_160_hasher.c
index 86d3340..8b55546 100644
--- a/libhashsum_init_ripemd_160_hasher.c
+++ b/libhashsum_init_ripemd_160_hasher.c
@@ -225,6 +225,7 @@ libhashsum_init_ripemd_160_hasher(struct libhashsum_hasher *this)
this->supports_non_whole_bytes = 1;
this->standard_partial_byte_input_encoding = LIBHASHSUM_MOST_SIGNIFICANT;
this->standard_partial_byte_output_encoding = LIBHASHSUM_UNSUPPORTED;
+ this->hash_excess_bits = 0;
this->process = &process;
this->finalise_const = &finalise_const;
this->finalise = &finalise;
diff --git a/libhashsum_init_ripemd_256_hasher.3 b/libhashsum_init_ripemd_256_hasher.3
index 97bb7af..13a5deb 100644
--- a/libhashsum_init_ripemd_256_hasher.3
+++ b/libhashsum_init_ripemd_256_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_ripemd_256_hasher - initialise state for RIPEMD-256 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -53,6 +54,10 @@ will be set to the block size RIPEMD-256 uses, in bytes.
will be set to the size of RIPEMD-256 hashes, in bytes
.RI ( LIBHASHSUM_RIPEMD_256_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_ripemd_256_hasher.c b/libhashsum_init_ripemd_256_hasher.c
index 316cc39..c08c262 100644
--- a/libhashsum_init_ripemd_256_hasher.c
+++ b/libhashsum_init_ripemd_256_hasher.c
@@ -233,6 +233,7 @@ libhashsum_init_ripemd_256_hasher(struct libhashsum_hasher *this)
this->supports_non_whole_bytes = 1;
this->standard_partial_byte_input_encoding = LIBHASHSUM_MOST_SIGNIFICANT;
this->standard_partial_byte_output_encoding = LIBHASHSUM_UNSUPPORTED;
+ this->hash_excess_bits = 0;
this->process = &process;
this->finalise_const = &finalise_const;
this->finalise = &finalise;
diff --git a/libhashsum_init_ripemd_320_hasher.3 b/libhashsum_init_ripemd_320_hasher.3
index eb5f7e9..1820b3b 100644
--- a/libhashsum_init_ripemd_320_hasher.3
+++ b/libhashsum_init_ripemd_320_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_ripemd_320_hasher - initialise state for RIPEMD-320 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -53,6 +54,10 @@ will be set to the block size RIPEMD-320 uses, in bytes.
will be set to the size of RIPEMD-320 hashes, in bytes
.RI ( LIBHASHSUM_RIPEMD_320_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_ripemd_320_hasher.c b/libhashsum_init_ripemd_320_hasher.c
index dad69a0..b513620 100644
--- a/libhashsum_init_ripemd_320_hasher.c
+++ b/libhashsum_init_ripemd_320_hasher.c
@@ -239,6 +239,7 @@ libhashsum_init_ripemd_320_hasher(struct libhashsum_hasher *this)
this->supports_non_whole_bytes = 1;
this->standard_partial_byte_input_encoding = LIBHASHSUM_MOST_SIGNIFICANT;
this->standard_partial_byte_output_encoding = LIBHASHSUM_UNSUPPORTED;
+ this->hash_excess_bits = 0;
this->process = &process;
this->finalise_const = &finalise_const;
this->finalise = &finalise;
diff --git a/libhashsum_init_sha0_hasher.3 b/libhashsum_init_sha0_hasher.3
index f943fa9..92f876d 100644
--- a/libhashsum_init_sha0_hasher.3
+++ b/libhashsum_init_sha0_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_sha0_hasher - initialise state for SHA-0 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -54,6 +55,10 @@ will be set to the block size SHA-0 uses, in bytes.
will be set to the size of SHA-0 hashes, in bytes
.RI ( LIBHASHSUM_SHA0_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_sha0_hasher.c b/libhashsum_init_sha0_hasher.c
index a860f77..379d7db 100644
--- a/libhashsum_init_sha0_hasher.c
+++ b/libhashsum_init_sha0_hasher.c
@@ -67,6 +67,7 @@ libhashsum_init_sha0_hasher(struct libhashsum_hasher *this)
this->supports_non_whole_bytes = 1;
this->standard_partial_byte_input_encoding = LIBHASHSUM_LEAST_SIGNIFICANT;
this->standard_partial_byte_output_encoding = LIBHASHSUM_UNSUPPORTED;
+ this->hash_excess_bits = 0;
this->process = &process;
this->finalise_const = &finalise_const;
this->finalise = &finalise;
diff --git a/libhashsum_init_sha1_hasher.3 b/libhashsum_init_sha1_hasher.3
index 936f7cc..292069e 100644
--- a/libhashsum_init_sha1_hasher.3
+++ b/libhashsum_init_sha1_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_sha1_hasher - initialise state for SHA-1 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -54,6 +55,10 @@ will be set to the block size SHA-1 uses, in bytes.
will be set to the size of SHA-1 hashes, in bytes
.RI ( LIBHASHSUM_SHA1_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_sha1_hasher.c b/libhashsum_init_sha1_hasher.c
index bd514b3..3be6428 100644
--- a/libhashsum_init_sha1_hasher.c
+++ b/libhashsum_init_sha1_hasher.c
@@ -67,6 +67,7 @@ libhashsum_init_sha1_hasher(struct libhashsum_hasher *this)
this->supports_non_whole_bytes = 1;
this->standard_partial_byte_input_encoding = LIBHASHSUM_LEAST_SIGNIFICANT;
this->standard_partial_byte_output_encoding = LIBHASHSUM_UNSUPPORTED;
+ this->hash_excess_bits = 0;
this->process = &process;
this->finalise_const = &finalise_const;
this->finalise = &finalise;
diff --git a/libhashsum_init_sha2_hasher.3 b/libhashsum_init_sha2_hasher.3
index 173b754..3943342 100644
--- a/libhashsum_init_sha2_hasher.3
+++ b/libhashsum_init_sha2_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_sha2_hasher - initialise state for SHA-2 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -92,6 +93,10 @@ will be set to the block size, in bytes
will be set to the hash size, in bytes
.RI ( hashbits/8 ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_sha2_hasher.c b/libhashsum_init_sha2_hasher.c
index ca455c3..e6aab61 100644
--- a/libhashsum_init_sha2_hasher.c
+++ b/libhashsum_init_sha2_hasher.c
@@ -96,6 +96,7 @@ libhashsum_init_sha2_hasher(struct libhashsum_hasher *this, unsigned algobits, s
this->supports_non_whole_bytes = 1;
this->standard_partial_byte_input_encoding = LIBHASHSUM_LEAST_SIGNIFICANT;
this->standard_partial_byte_output_encoding = LIBHASHSUM_UNSUPPORTED;
+ this->hash_excess_bits = 0;
this->process = &process;
this->finalise_const = &finalise_const;
this->finalise = &finalise;
diff --git a/libhashsum_init_sha3_224_hasher.3 b/libhashsum_init_sha3_224_hasher.3
index 693be8b..9d70010 100644
--- a/libhashsum_init_sha3_224_hasher.3
+++ b/libhashsum_init_sha3_224_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_sha3_224_hasher - initialise state for SHA-3-224 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -55,6 +56,10 @@ will be set to the block size SHA-3-224 uses, in bytes.
will be set to the size of SHA-3-224 hashes, in bytes
.RI ( LIBHASHSUM_SHA3_224_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_sha3_256_hasher.3 b/libhashsum_init_sha3_256_hasher.3
index 41f4eb0..fadabf4 100644
--- a/libhashsum_init_sha3_256_hasher.3
+++ b/libhashsum_init_sha3_256_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_sha3_256_hasher - initialise state for SHA-3-256 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -55,6 +56,10 @@ will be set to the block size SHA-3-256 uses, in bytes.
will be set to the size of SHA-3-256 hashes, in bytes
.RI ( LIBHASHSUM_SHA3_256_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_sha3_384_hasher.3 b/libhashsum_init_sha3_384_hasher.3
index 55b6490..7913833 100644
--- a/libhashsum_init_sha3_384_hasher.3
+++ b/libhashsum_init_sha3_384_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_sha3_384_hasher - initialise state for SHA-3-384 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -55,6 +56,10 @@ will be set to the block size SHA-3-384 uses, in bytes.
will be set to the size of SHA-3-384 hashes, in bytes
.RI ( LIBHASHSUM_SHA3_384_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_sha3_512_hasher.3 b/libhashsum_init_sha3_512_hasher.3
index 444d518..97ff402 100644
--- a/libhashsum_init_sha3_512_hasher.3
+++ b/libhashsum_init_sha3_512_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_sha3_512_hasher - initialise state for SHA-3-512 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -55,6 +56,10 @@ will be set to the block size SHA-3-512 uses, in bytes.
will be set to the size of SHA-3-512 hashes, in bytes
.RI ( LIBHASHSUM_SHA3_512_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_sha3_hasher.3 b/libhashsum_init_sha3_hasher.3
index cbd01d4..a4ff2e6 100644
--- a/libhashsum_init_sha3_hasher.3
+++ b/libhashsum_init_sha3_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_sha3_hasher - initialise state for SHA-3 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -59,6 +60,10 @@ will be set to the block size, in bytes.
will be set to the hash size, in bytes
.RI ( hashbits/8 ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_sha_224_hasher.3 b/libhashsum_init_sha_224_hasher.3
index ed6d957..1cc9acc 100644
--- a/libhashsum_init_sha_224_hasher.3
+++ b/libhashsum_init_sha_224_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_sha_224_hasher - initialise state for SHA-224 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -55,6 +56,10 @@ will be set to the block size SHA-224 uses, in bytes.
will be set to the size of SHA-224 hashes, in bytes
.RI ( LIBHASHSUM_SHA_224_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_sha_256_hasher.3 b/libhashsum_init_sha_256_hasher.3
index cf73e23..16eeb0e 100644
--- a/libhashsum_init_sha_256_hasher.3
+++ b/libhashsum_init_sha_256_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_sha_256_hasher - initialise state for SHA-256 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -55,6 +56,10 @@ will be set to the block size SHA-256 uses, in bytes.
will be set to the size of SHA-256 hashes, in bytes
.RI ( LIBHASHSUM_SHA_256_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_sha_384_hasher.3 b/libhashsum_init_sha_384_hasher.3
index 3be0a44..db41e20 100644
--- a/libhashsum_init_sha_384_hasher.3
+++ b/libhashsum_init_sha_384_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_sha_384_hasher - initialise state for SHA-384 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -55,6 +56,10 @@ will be set to the block size SHA-384 uses, in bytes.
will be set to the size of SHA-384 hashes, in bytes
.RI ( LIBHASHSUM_SHA_384_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_sha_512_224_hasher.3 b/libhashsum_init_sha_512_224_hasher.3
index cdbb75d..f8dd4b7 100644
--- a/libhashsum_init_sha_512_224_hasher.3
+++ b/libhashsum_init_sha_512_224_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_sha_512_224_hasher - initialise state for SHA-512/224 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -55,6 +56,10 @@ will be set to the block size SHA-512/224 uses, in bytes.
will be set to the size of SHA-512/224 hashes, in bytes
.RI ( LIBHASHSUM_SHA_512_224_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_sha_512_256_hasher.3 b/libhashsum_init_sha_512_256_hasher.3
index 6100c6f..a75db16 100644
--- a/libhashsum_init_sha_512_256_hasher.3
+++ b/libhashsum_init_sha_512_256_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_sha_512_256_hasher - initialise state for SHA-512/256 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -55,6 +56,10 @@ will be set to the block size SHA-512/256 uses, in bytes.
will be set to the size of SHA-512/256 hashes, in bytes
.RI ( LIBHASHSUM_SHA_512_256_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_sha_512_hasher.3 b/libhashsum_init_sha_512_hasher.3
index 7dc87ba..1b221e8 100644
--- a/libhashsum_init_sha_512_hasher.3
+++ b/libhashsum_init_sha_512_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_sha_512_hasher - initialise state for SHA-512 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -55,6 +56,10 @@ will be set to the block size SHA-512 uses, in bytes.
will be set to the size of SHA-512 hashes, in bytes
.RI ( LIBHASHSUM_SHA_512_HASH_SIZE ).
.PP
+.I hasher->hash_excess_bits
+will be set to 0 to indicate that the hash size
+is a whole number of bytes.
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_shake128_hasher.3 b/libhashsum_init_shake128_hasher.3
index 877dd29..7710e16 100644
--- a/libhashsum_init_shake128_hasher.3
+++ b/libhashsum_init_shake128_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_shake128_hasher - initialise state for SHAKE128 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -76,6 +77,16 @@ if
.I hashbits
is 0 or 128).
.PP
+.I hasher->hash_excess_bits
+will be set to number of bits the last byte in
+the hash is padded with (it will be padded with
+cleared bits in its most significant part). As
+long as
+.I hashbits
+is a multiple of 8, this number will be 0 (the
+entire last byte is used), otherwise, it will be
+.IR 8-(hashbits&7) .
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_shake256_hasher.3 b/libhashsum_init_shake256_hasher.3
index 3de4501..e3b956c 100644
--- a/libhashsum_init_shake256_hasher.3
+++ b/libhashsum_init_shake256_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_shake256_hasher - initialise state for SHAKE256 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -76,6 +77,16 @@ if
.I hashbits
is 0 or 256).
.PP
+.I hasher->hash_excess_bits
+will be set to number of bits the last byte in
+the hash is padded with (it will be padded with
+cleared bits in its most significant part). As
+long as
+.I hashbits
+is a multiple of 8, this number will be 0 (the
+entire last byte is used), otherwise, it will be
+.IR 8-(hashbits&7) .
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_shake512_hasher.3 b/libhashsum_init_shake512_hasher.3
index 547da3c..5364381 100644
--- a/libhashsum_init_shake512_hasher.3
+++ b/libhashsum_init_shake512_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_shake512_hasher - initialise state for SHAKE512 hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -76,6 +77,16 @@ if
.I hashbits
is 0 or 512).
.PP
+.I hasher->hash_excess_bits
+will be set to number of bits the last byte in
+the hash is padded with (it will be padded with
+cleared bits in its most significant part). As
+long as
+.I hashbits
+is a multiple of 8, this number will be 0 (the
+entire last byte is used), otherwise, it will be
+.IR 8-(hashbits&7) .
+.PP
.I hasher->hash_output
will be set to
.IR NULL .
diff --git a/libhashsum_init_shake_hasher.3 b/libhashsum_init_shake_hasher.3
index 5ab1320..0891274 100644
--- a/libhashsum_init_shake_hasher.3
+++ b/libhashsum_init_shake_hasher.3
@@ -15,6 +15,7 @@ libhashsum_init_shake_hasher - initialise state for SHAKE hashing
unsigned char \fIsupports_non_whole_bytes\fP;
unsigned char \fIstandard_partial_byte_input_encoding\fP;
unsigned char \fIstandard_partial_byte_output_encoding\fP;
+ unsigned char \fIhash_excess_bits\fP;
size_t (*\fIprocess\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP);
int (*\fIfinalise_const\fP)(struct libhashsum_hasher *\fPthis\fP, const void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP);
int (*\fIfinalise\fP)(struct libhashsum_hasher *\fPthis\fP, void *\fPdata\fP, size_t \fPbytes\fP, unsigned \fPextra_bits\fP, size_t \fPsize\fP);
@@ -83,7 +84,17 @@ will be set to the block size, in bytes.
.PP
.I hasher->hash_size
will be set to the hash size, in bytes
-.RI ( (hashbits?hashbits:hcapbits)/8 ).
+.RI ( ((hashbits?hashbits:hcapbits)+7)/8 ).
+.PP
+.I hasher->hash_excess_bits
+will be set to number of bits the last byte in
+the hash is padded with (it will be padded with
+cleared bits in its most significant part). As
+long as
+.I hashbits
+is a multiple of 8, this number will be 0 (the
+entire last byte is used), otherwise, it will be
+.IR 8-(hashbits&7) .
.PP
.I hasher->hash_output
will be set to