diff options
Diffstat (limited to '')
-rw-r--r-- | libhashsum_init_hasher_from_string.3 | 78 |
1 files changed, 75 insertions, 3 deletions
diff --git a/libhashsum_init_hasher_from_string.3 b/libhashsum_init_hasher_from_string.3 index 00f7723..db88547 100644 --- a/libhashsum_init_hasher_from_string.3 +++ b/libhashsum_init_hasher_from_string.3 @@ -16,6 +16,7 @@ libhashsum_init_hasher_from_string - initialise state for hashing 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); + void (*\fIstretch\fP)(struct libhashsum_hasher *\fPthis\fP, int \fPskip\fP, void *\fPbuffer\fP); void (*\fIdestroy\fP)(struct libhashsum_hasher *\fPthis\fP); union libhashsum_state { /* definition omitted */ } \fIstate\fP; }; @@ -113,7 +114,7 @@ no greater than .I hasher->finalise_const will be set to a pointer to the function to call once the entire text being hashed has been loaded, -and to get the hash of the text. It's parameter +and to get the hash of the text. Its parameter .I this shall be set to .IR hasher . @@ -139,8 +140,22 @@ to a pointer to a buffer in containing the binary hash of the processed data. Otherwise, the function will return -1, and set .I errno -to indicate the error. The function will failure -if: +to indicate the error. However, if the user has +already set +.I hasher->hash_output +to a +.RI non- NULL +pointer, the function will output the binary hash +to that pointer instead without redirecting +.I hasher->hash_output +(the application must make sure this buffer is +sufficiently large), provided that the library +supports this behaviour for the selected hash +function, otherwise it will behave as if +.I hasher->hash_output +was set to +.IR NULL . +The function will failure if: .RS .TP .B EINVAL @@ -179,6 +194,63 @@ shall be set to the size of the buffer is otherwise identical to .IR *hasher->finalise_const . .PP +.I hasher->stretch +will be set to +.IR NULL , +however upon successful completion of +.I *hasher->finalise +or +.IR *hasher->finalise_const , +.I hasher->stretch +will be set to point to a function that can be +used to extend the hash by +.I hasher->hash_size +bytes, and can be called repeated, provided that the +hash function supports extending the hash. If the +hash extention support is limited, +.I *hasher->stretch +will reset +.I hasher->stretch +to +.I NULL +once the limit has been reached. If the hash +function supports generating hashes at any time, +.I hasher->stretch +will be set to point to a function at immediately. +The hash extent will be written to a buffer in +.I hasher->state +(which +.I *hasher->finalize +and +.I *hasher->finalize_const +also write the hash to), and +.I hasher->hash_output +will be set to point to this buffer. +.IR *hasher->stretch 's +parameter +.I this +shall be +.IR hasher . +Its parameter +.I skip +can be set to non-zero if the hash extent should +be discarded +.RI ( hasher->hash_output +will not be set in this case). +Its parameter +.I buffer +shall be +.I NULL +for the above described behaviour, or an sufficiently +large buffer the function shall output the hash extent +to. If +.I buffer +is +.RI non- NULL , +.I hasher->hash_output +will be set to +.IR NULL ). +.PP .I hasher->destroy will either be set to .I NULL |