FileRecovery-nyufile / src / main / utils.h
utils.h
Raw
#ifndef _UTILS_H
#define _UTILS_H


/**
 * This function prints out the usage of nyufile and exits immediately.
 *
 * Input:
 *                                          None.
 * 
 * Return:
 *                                          None.
 *
**/
void usage();

/**
 * This function determines if an binary SHA1 hash and a hexdump matches.
 *
 * Input:
 * SHA1hash                                 The binary SHA1 hash.
 * dumpedResult                             The hexdump result.
 * 
 * Return:
 *                                          1 stands for a match, 0 otherwise.
 *
 * Example:
 *                                          For instance, if `xxd` for SHA1hash gives the following:
 *                                              00000000: c91761a2cc1562d3  
 *                                              00000010: 6585
 *                                          then it will compare the string "c91761a2cc1562d3" with dumpedResult.
 * 
**/
int hashMatch(unsigned char *SHA1hash, char *dumpedResult);

/**
 * This function returns all possible permutations of a certain length of an unsigned integer array.
 * **THE RETURNED POINTER IS LOCATED ON THE HEAP AND NEEDS TO BE FREED!**
 * **THE POINTERS THAT THE RETURNED POINTER POINTS TO ARE LOCATED ON THE HEAP AND NEEDS TO BE FREED!**
 *
 * Input:
 * array                                    The pointer to the unsigned integer array for permuting.
 * length                                   The length of the unsigned integer array for permuting.
 * size                                     The size of the permutation.
 * 
 * Return:
 *                                          The array of the pointers to all possible permutations of the given size.
 * 
**/
unsigned int **permute(unsigned int *array, int length, int size);


#endif