diff options
author | phk <phk@FreeBSD.org> | 2001-03-17 10:00:50 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2001-03-17 10:00:50 +0000 |
commit | cf0fcea2b7ae26222f4865e9a6df53972a02f443 (patch) | |
tree | 7fe491bdf6b8f8e4c7ca17e38a2e3f0368875806 /lib/libmd/sha.3 | |
parent | 670e711dd19510316ecaa1f30d78f16ba66492f6 (diff) | |
download | FreeBSD-src-cf0fcea2b7ae26222f4865e9a6df53972a02f443.zip FreeBSD-src-cf0fcea2b7ae26222f4865e9a6df53972a02f443.tar.gz |
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
Diffstat (limited to 'lib/libmd/sha.3')
-rw-r--r-- | lib/libmd/sha.3 | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/libmd/sha.3 b/lib/libmd/sha.3 index c670ad5..90b7277 100644 --- a/lib/libmd/sha.3 +++ b/lib/libmd/sha.3 @@ -18,12 +18,14 @@ .Nm SHA_Final , .Nm SHA_End , .Nm SHA_File , +.Nm SHA_FileChunk , .Nm SHA_Data , .Nm SHA1_Init , .Nm SHA1_Update , .Nm SHA1_Final , .Nm SHA1_End , .Nm SHA1_File , +.Nm SHA1_FileChunk , .Nm SHA1_Data .Nd calculate the FIPS 160 and 160-1 ``SHA'' message digests .Sh LIBRARY @@ -42,6 +44,8 @@ .Ft "char *" .Fn SHA_File "const char *filename" "char *buf" .Ft "char *" +.Fn SHA_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length" +.Ft "char *" .Fn SHA_Data "const unsigned char *data" "unsigned int len" "char *buf" .Ft void .Fn SHA1_Init "SHA_CTX *context" @@ -54,6 +58,8 @@ .Ft "char *" .Fn SHA1_File "const char *filename" "char *buf" .Ft "char *" +.Fn SHA1_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length" +.Ft "char *" .Fn SHA1_Data "const unsigned char *data" "unsigned int len" "char *buf" .Sh DESCRIPTION The @@ -101,6 +107,23 @@ calculates the digest of a file, and uses .Fn SHA1_End to return the result. If the file cannot be opened, a null pointer is returned. +.Fn SHA1_FileChunk +is similar to +.Fn SHA1_File , +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 SHA1_FileChunk +calculates the digest from +.Ar offset +to the end of file. .Fn SHA1_Data calculates the digest of a chunk of data in memory, and uses .Fn SHA1_End |