/* * Copyright 2010. Ivan Voras * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Helper library for comparing files through hashing. */ #ifndef _HASHJOB_H_ #define _HASHJOB_H_ enum HASH_TYPE { HASH_NONE, HASH_MD5, HASH_SHA256 }; #define HASH_MAX_LEN 65 struct hashjob { char *filename; enum HASH_TYPE type; unsigned hash_len; char hash[HASH_MAX_LEN]; pthread_t thread; int finished; }; int hashjob_start(struct hashjob *job, char *filename, enum HASH_TYPE type); int hashjob_finish(struct hashjob *job); #endif