From cf0fcea2b7ae26222f4865e9a6df53972a02f443 Mon Sep 17 00:00:00 2001 From: phk Date: Sat, 17 Mar 2001 10:00:50 +0000 Subject: Add a new entrypoint to the hashes in libmd: char * FooFileChunk(const char *filename, char *buf, off_t offset, off_t length) Which only hashes part of a file. Implement FooFile() in terms of this function. Submitted by: roam --- lib/libmd/mdX.3 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/libmd/mdX.3') diff --git a/lib/libmd/mdX.3 b/lib/libmd/mdX.3 index cc44122..412aeba 100644 --- a/lib/libmd/mdX.3 +++ b/lib/libmd/mdX.3 @@ -18,6 +18,7 @@ .Nm MDXFinal , .Nm MDXEnd , .Nm MDXFile , +.Nm MDXFileChunk , .Nm MDXData .Nd calculate the RSA Data Security, Inc., ``MDX'' message digest .Sh LIBRARY @@ -38,6 +39,8 @@ .Ft "char *" .Fn MDXFile "const char *filename" "char *buf" .Ft "char *" +.Fn MDXFileChunk "const char *filename" "char *buf" "off_t offset" "off_t length" +.Ft "char *" .Fn MDXData "const unsigned char *data" "unsigned int len" "char *buf" .Sh DESCRIPTION The MDX functions calculate a 128-bit cryptographic checksum (digest) @@ -88,6 +91,23 @@ calculates the digest of a file, and uses .Fn MDXEnd to return the result. If the file cannot be opened, a null pointer is returned. +.Fn MDXFileChunk +is similar to +.Fn MDXFile , +but it only calculates the digest over a byte-range of the file specified, +starting at +.Ar offset +and spanning +.Ar length +bytes. +If the +.Ar length +parameter is specified as 0, or more than the length of the remaining part +of the file, +.Fn MDXFileChunk +calculates the digest from +.Ar offset +to the end of file. .Fn MDXData calculates the digest of a chunk of data in memory, and uses .Fn MDXEnd -- cgit v1.1