# hk_index.c File Reference

## Detailed Description

Contains functions to read and process hash keeper database files.

`#include "hashdb_tools_i.h"`

## Functions

uint8_t | hk_test (FILE *hFile)
| Test the file to see if it is a hashkeeper database.
uint8_t | hk_makeindex (TSK_HDB_INFO *hdb_info, TSK_TCHAR *dbtype)
| Process the database to create a sorted index of it.
uint8_t | hk_getentry (TSK_HDB_INFO *hdb_info, char *hash, OFF_T offset, TSK_HDB_FLAG_ENUM flags, TSK_HDB_LOOKUP_FN action, void *cb_ptr)
| Find the corresponding name at the given offset.

## Function Documentation

uint8_t hk_getentry | ( | TSK_HDB_INFO * | hdb_info,
|  | char * | hash,
|  | OFF_T | offset,
|  | TSK_HDB_FLAG_ENUM | flags,
|  | TSK_HDB_LOOKUP_FN | action,
|  | void * | cb_ptr
| ) |

Find the corresponding name at the given offset.

The offset was likely determined from the index. The entries in the DB following the one specified are also processed if they have the same hash value and their name is different. The callback is called for each entry.

Parameters:

  | hdb_info | Data base to get data from.
  | hash | MD5 hash value that was searched for
  | offset | Byte offset where hash value should be located in db_file
  | flags |
  | action | Callback used for each entry found in lookup
  | cb_ptr | Pointer to data passed to callback

Returns:
  1 on error and 0 on success

uint8_t hk_makeindex | ( | TSK_HDB_INFO * | hdb_info,
|  | TSK_TCHAR * | dbtype
| ) |

Process the database to create a sorted index of it.

Consecutive entries with the same hash value are not added to the index, but will be found during lookup.

Parameters:

  | hdb_info | Hash database to make index of
  | dbtype | Text of type of database (should always be TSK_HDB_DBTYPE_HK_STR)

Returns:
  1 on error and 0 on success.

uint8_t hk_test | ( | FILE * | hFile | ) |

Test the file to see if it is a hashkeeper database.

Parameters:

  | hFile | File handle to hash database

Returns:
  1 if hk and 0 if not