|  |  |  | Redland RDF Library Manual |  | 
|---|---|---|---|---|
| Top | Description | ||||
typedef librdf_digest; typedef librdf_digest_factory; librdf_digest* librdf_new_digest (librdf_world *world,const char *name); void librdf_free_digest (librdf_digest *digest); void librdf_digest_init (librdf_digest *digest); void librdf_digest_update (librdf_digest *digest,unsigned char *buf,size_t length); void librdf_digest_update_string (librdf_digest *digest,unsigned char *string); void librdf_digest_final (librdf_digest *digest); void* librdf_digest_get_digest (librdf_digest *digest); size_t librdf_digest_get_digest_length (librdf_digest *digest); char* librdf_digest_to_string (librdf_digest *digest); void librdf_digest_print (librdf_digest *digest,FILE *fh);
Create a message digest over a block of data. Includes implementations of MD5, RMD160 and SHA1.
typedef struct librdf_digest_factory_s librdf_digest_factory;
Redland digest factory class.
librdf_digest* librdf_new_digest (librdf_world *world,const char *name);
Constructor - create a new librdf_digest object.
After construction, data should be added to the digest using librdf_digest_update or librdf_digest_update_string with librdf_digest_final to signify finishing. Then the digest value can be returned directly with librdf_digest_get_digest of librdf_digest_get_digest_length bytes or as a hex encoded string with librdf_digest_to_string. The digest can be re-initialised for new data with librdf_digest_init.
| 
 | redland world object | 
| 
 | the digest name to use to create this digest | 
| Returns : | new librdf_digest object or NULL | 
void                librdf_free_digest                  (librdf_digest *digest);
Destructor - destroy a librdf_digest object.
| 
 | the digest | 
void                librdf_digest_init                  (librdf_digest *digest);
(Re)initialise the librdf_digest object.
This is automatically called on construction but can be used to re-initialise the digest to the initial state for digesting new data.
| 
 | the digest | 
void librdf_digest_update (librdf_digest *digest,unsigned char *buf,size_t length);
Add more data to the librdf_digest object.
| 
 | the digest | 
| 
 | the data buffer | 
| 
 | the length of the data | 
void librdf_digest_update_string (librdf_digest *digest,unsigned char *string);
Add a string to the librdf_digest object.
| 
 | the digest | 
| 
 | string to add | 
void                librdf_digest_final                 (librdf_digest *digest);
Finish the digesting of data.
The digest can now be returned via librdf_digest_get_digest().
| 
 | the digest | 
void*               librdf_digest_get_digest            (librdf_digest *digest);
Get the calculated digested value.
| 
 | the digest | 
| Returns : | pointer to the memory containing the digest. It will be librdf_digest_get_digest_length bytes in length. | 
size_t              librdf_digest_get_digest_length     (librdf_digest *digest);
Get length of the calculated digested.
| 
 | the digest | 
| Returns : | size of the digest in bytes | 
char*               librdf_digest_to_string             (librdf_digest *digest);
Get a string representation of the digest object.
| 
 | the digest | 
| Returns : | a newly allocated string that represents the digest.
This must be released by the caller using free() | 
void librdf_digest_print (librdf_digest *digest,FILE *fh);
Print the digest to a FILE handle.
| 
 | the digest | 
| 
 | file handle |