Provided by: libwget0_0.0.20170806-1_amd64 bug

NAME

       libwget-hash

SYNOPSIS

   Typedefs
       typedef struct _wget_hash_hd_st wget_hash_hd_t
           Type for hash / digest routines.

   Enumerations
       enum wget_digest_algorithm_t { WGET_DIGTYPE_UNKNOWN, WGET_DIGTYPE_MD5, WGET_DIGTYPE_SHA1,
           WGET_DIGTYPE_RMD160, WGET_DIGTYPE_MD2, WGET_DIGTYPE_SHA256, WGET_DIGTYPE_SHA384,
           WGET_DIGTYPE_SHA512, WGET_DIGTYPE_SHA224 } Enumeration of different hash digest
           algorithms. "

   Functions
       wget_digest_algorithm_t wget_hash_get_algorithm (const char *hashname)
       int wget_hash_fast (wget_digest_algorithm_t algorithm, const void *text, size_t textlen,
           void *digest)
       int wget_hash_get_len (wget_digest_algorithm_t algorithm)
       int wget_hash_init (wget_hash_hd_t *handle, wget_digest_algorithm_t algorithm)
       int wget_hash (wget_hash_hd_t *handle, const void *text, size_t textlen)
       void wget_hash_deinit (wget_hash_hd_t *handle, void *digest)
       int wget_hash_file_fd (const char *hashname, int fd, char *digest_hex, size_t
           digest_hex_size, off_t offset, off_t length)
       int wget_hash_file_offset (const char *hashname, const char *fname, char *digest_hex,
           size_t digest_hex_size, off_t offset, off_t length)
       int wget_hash_file (const char *hashname, const char *fname, char *digest_hex, size_t
           digest_hex_size)

Detailed Description

Enumeration Type Documentation

   enum wget_digest_algorithm_t
       Enumeration of different hash digest algorithms.

       Enumerator

       WGET_DIGTYPE_UNKNOWN
              Indicates 'Unknown hash algorithm', returned by wget_hash_get_algorithm()

       WGET_DIGTYPE_MD5
              Type 'MD5' digest

       WGET_DIGTYPE_SHA1
              Type SHA1 digest

       WGET_DIGTYPE_RMD160
              Type RMD160 digest

       WGET_DIGTYPE_MD2
              Type 'MD2' digest

       WGET_DIGTYPE_SHA256
              Type 'SHA256' digest

       WGET_DIGTYPE_SHA384
              Type 'SHA384' digest

       WGET_DIGTYPE_SHA512
              Type 'SHA512' digest

       WGET_DIGTYPE_SHA224
              Type 'SHA224' digest

Function Documentation

   wget_digest_algorithm_t wget_hash_get_algorithm (const char * hashname)
       Parameters:
           hashname Name of the hashing algorithm (see table below)

       Returns:
           A constant to be used by libwget hashing functions

       Get the hashing algorithms list item that corresponds to the named hashing algorithm.

       This function returns a constant that uniquely identifies a known supported hashing
       algorithm within libwget. All the supported algorithms are listed in the
       wget_digest_algorithm_t enum.

       Algorithm name Constant  sha1 or sha-1WGET_DIGTYPE_SHA1 sha256 or
       sha-256WGET_DIGTYPE_SHA256 sha512 or sha-512WGET_DIGTYPE_SHA512 sha224 or
       sha-224WGET_DIGTYPE_SHA224 sha384 or sha-384WGET_DIGTYPE_SHA384 md5WGET_DIGTYPE_MD5
       md2WGET_DIGTYPE_MD2 rmd160WGET_DIGTYPE_RMD160

   int wget_hash_fast (wget_digest_algorithm_t algorithm, const void * text, size_t textlen, void
       * digest)
       Parameters:
           algorithm One of the hashing algorithms returned by wget_hash_get_algorithm()
           text Input data to hash
           textlen Length of the input data
           digest Caller-supplied buffer where the output hash will be placed

       Returns:
           Zero on success or a negative value on error

       Convenience function to hash the given data in a single call.

       The caller must ensure that the provided output buffer digest is large enough to store the
       hash. A particular hash algorithm is guaranteed to always generate the same amount of data
       (e.g. 512 bits) but different hash algorithms will output different lengths of data. To
       get the output length of the chosen algorithm algorithm, call wget_hash_get_len().

       Note:
           This function's behavior depends on the underlying cryptographic engine libwget was
           compiled with.

   int wget_hash_get_len (wget_digest_algorithm_t algorithm)
       Parameters:
           algorithm One of the hashing algorithms returned by wget_hash_get_algorithm()

       Returns:
           The length of the output data generated by the algorithm

       Determines the output length of the given hashing algorithm.

       A particular hash algorithm is guaranteed to always generate the same amount of data (e.g.
       512 bits) but different hash algorithms will output different lengths of data.

   int wget_hash_init (wget_hash_hd_t * handle, wget_digest_algorithm_t algorithm)
       Parameters:
           handle Caller-provided pointer to a wget_hash_hd_t structure where the handle to this
           hashing primitive will be stored, needed in subsequent calls to wget_hash()
           algorithm One of the hashing algorithms returned by wget_hash_get_algorithm()

       Returns:
           Zero on success or a negative value on error

       Initialize the cryptographic engine to compute hashes with the given hashing algorithm, as
       well as the hashing algorithm itself.

       After this function returns, wget_hash() might be called as many times as desired.

   int wget_hash (wget_hash_hd_t * handle, const void * text, size_t textlen)
       Parameters:
           handle Handle to the hashing primitive returned by a subsequent call to
           wget_hash_init()
           text Input data
           textlen Length of the input data

       Returns:
           Zero on success or a negative value on error

       Update the digest by adding additional input data to it. This method can be called as many
       times as desired. Once finished, call wget_hash_deinit() to complete the computation and
       get the resulting hash.

   void wget_hash_deinit (wget_hash_hd_t * handle, void * digest)
       Parameters:
           handle Handle to the hashing primitive returned by a subsequent call to
           wget_hash_init()
           digest Caller-supplied buffer where the output hash will be placed.

       Complete the hash computation by performing final operations, such as padding, and obtain
       the final result. The result will be placed in the caller-supplied buffer digest. The
       caller must ensure that the provided output buffer digest is large enough to store the
       hash. To get the output length of the chosen algorithm algorithm, call
       wget_hash_get_len().

   int wget_hash_file_fd (const char * hashname, int fd, char * digest_hex, size_t
       digest_hex_size, off_t offset, off_t length)
       Parameters:
           hashname Name of the hashing algorithm. See wget_hash_get_algorithm()
           fd File descriptor for the target file
           digest_hex caller-supplied buffer that will contain the resulting hex string
           digest_hex_size Length of digest_hex
           offset File offset to start hashing at
           length Number of bytes to hash, starting from offset. Zero will hash up to the end of
           the file

       Returns:
           0 on success or -1 in case of failure

       Compute the hash of the contents of the target file and return its hex representation.

       This function will encode the resulting hash in a string of hex digits, and place that
       string in the user-supplied buffer digest_hex.

   int wget_hash_file_offset (const char * hashname, const char * fname, char * digest_hex,
       size_t digest_hex_size, off_t offset, off_t length)
       Parameters:
           hashname Name of the hashing algorithm. See wget_hash_get_algorithm()
           fname Target file name
           digest_hex Caller-supplied buffer that will contain the resulting hex string
           digest_hex_size Length of digest_hex
           offset File offset to start hashing at
           length Number of bytes to hash, starting from offset. Zero will hash up to the end of
           the file

       Returns:
           0 on success or -1 in case of failure

       Compute the hash of the contents of the target file starting from offset and up to length
       bytes and return its hex representation.

       This function will encode the resulting hash in a string of hex digits, and place that
       string in the user-supplied buffer digest_hex.

   int wget_hash_file (const char * hashname, const char * fname, char * digest_hex, size_t
       digest_hex_size)
       Parameters:
           hashname Name of the hashing algorithm. See wget_hash_get_algorithm()
           fname Target file name
           digest_hex Caller-supplied buffer that will contain the resulting hex string
           digest_hex_size Length of digest_hex

       Returns:
           0 on success or -1 in case of failure

       Compute the hash of the contents of the target file and return its hex representation.

       This function will encode the resulting hash in a string of hex digits, and place that
       string in the user-supplied buffer digest_hex.

Author

       Generated automatically by Doxygen for wget2 from the source code.