-3

I'm trying to run this code on Eclipse. But there is an error about the header mhash.h

"Error: No such a file or directory"

The code is this:

#include <mhash.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
    int i;
    MHASH td;
    unsigned char buffer;
    unsigned char *hash;
    td = mhash_init(MHASH_MD5);
    if (td == MHASH_FAILED) exit(1);
    while (fread(&buffer, 1, 1, stdin) == 1) {
            mhash(td, &buffer, 1);
    }
    hash = mhash_end(td);
    printf("Hash:");
    for (i = 0; i < mhash_get_block_size(MHASH_MD5); i++) {
            printf("%.2x", hash[i]);
    }
    printf("\n");
    exit(0);
}
zankal
  • 1
  • 1
  • Where is mhash.h supposed to come from ? – nos Apr 15 '15 at 14:11
  • I dont know how to add it to my includes. – zankal Apr 15 '15 at 14:13
  • What I'm asking is how you come to know about mhash.h. What is it ? Have you installed something that should provide you with an mhash.h header file ? The next thing you need to figure out if this is something you have installed, is where you have installed it, and where the mhash.h header file is located. – nos Apr 15 '15 at 14:20
  • I'm asking it already. I havent installed anything about mhash.h yet ? what should I do first ? – zankal Apr 15 '15 at 14:26
  • 1
    After installing the mhash.h file **PROPERLY**, it shouldn't be an issue including it. If it is an issue, it is because you didn't install it properly. see http://stackoverflow.com/questions/11137033/what-is-the-right-way-to-install-header-files-from-some-package – that-ru551an-guy Apr 15 '15 at 15:45

1 Answers1

0

You need to install mhash first. Get it from http://sourceforge.net/projects/mhash

Selçuk Cihan
  • 1,979
  • 2
  • 17
  • 30