From 9789d16eb67f8cdcba8095530b460974d4645324 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 5 Sep 2024 19:26:08 +0200 Subject: Document standard_partial_byte_{in,out}put_encoding in man pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libhashsum_init_ripemd_320_hasher.3 | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'libhashsum_init_ripemd_320_hasher.3') diff --git a/libhashsum_init_ripemd_320_hasher.3 b/libhashsum_init_ripemd_320_hasher.3 index 41b2c2a..eb5f7e9 100644 --- a/libhashsum_init_ripemd_320_hasher.3 +++ b/libhashsum_init_ripemd_320_hasher.3 @@ -13,6 +13,8 @@ libhashsum_init_ripemd_320_hasher - initialise state for RIPEMD-320 hashing size_t \fIhash_size\fP; unsigned char *\fIhash_output\fP; unsigned char \fIsupports_non_whole_bytes\fP; + unsigned char \fIstandard_partial_byte_input_encoding\fP; + unsigned char \fIstandard_partial_byte_output_encoding\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); @@ -192,6 +194,42 @@ function fails if: .B ENOSYS Support was excluded at compile time. +.SH EXTENDED DESCRIPTION +libhashsum has normalises the all implemented hash +functions to always use the least significant bits +in non-whole octets, however each hash function has +its unstandarded. To make it easier to create an +application the use the same encoding of partial +octets as other application using any particular +hash function, +.B struct libhashsum_hasher +contains two fields: +.I standard_partial_byte_input_encoding +and +.IR standard_partial_byte_output_encoding ; +which are merely informtional. They are not set to +specify how libhashsum expects and encodes non-whole +octets, but rather specify how partial bytes are +encoded in the reference implementation or +specification of a hash function. +.PP +RIPEMD-320 always output a fixed, whole number of +octets, so +.I this->standard_partial_byte_output_encoding +will be set to +.IR LIBHASHSUM_UNSUPPORTED , +however, the hash function allows non-whole octet +input, and in its standard uses the most +significant bits of non-whole octets, thus +.I this->standard_partial_byte_input_encoding +will be set to +.IR LIBHASHSUM_MOST_SIGNIFICANT , +which the opposite behaviour of what libhashsum +implements, meaning that the last octet most be +reversed when converting between the hash function's +standard representation and libhashsum's +representation. + .SH HISTORY libhashsum 1.0. -- cgit v1.2.3-70-g09d2