title: Compile a program using mhash
body: <p>I am trying to use lessfs and learning how it uses mhash to produce its cryptographic fingerprints, so I am taking a look at mhash to see how it handles the hashing algorithms, so I am trying to run some of the examples provided in the program, but I am running into complications and errors</p>
  
  <p>The Mhash example that I was trying to solve is found here: <a href="http://mhash.sourceforge.net/mhash.3.html" rel="nofollow">http://mhash.sourceforge.net/mhash.3.html</a> (or below)</p>
  
  <pre><code>#include &lt;mhash.h&gt;
   #include &lt;stdio.h&gt;
  
   int main()
   {
  
          char password[] = "Jefe";
          int keylen = 4;
          char data[] = "what do ya want for nothing?";
          int datalen = 28;
          MHASH td;
          unsigned char *mac;
          int j;
  
  
          td = mhash_hmac_init(MHASH_MD5, password, keylen,
                              mhash_get_hash_pblock(MHASH_MD5));
  
          mhash(td, data, datalen);
          mac = mhash_hmac_end(td);
  
   /* 
    * The output should be 0x750c783e6ab0b503eaa86e310a5db738
    * according to RFC 2104.
    */
  
          printf("0x");
          for (j = 0; j &lt; mhash_get_block_size(MHASH_MD5); j++) {
                  printf("%.2x", mac[j]);
          }
          printf("\n");
  
  
          exit(0);
   }
  </code></pre>
  
  <p>But I get the following errors:</p>
  
  <pre><code>mhash.c.text+0x6c): undefined reference to `mhash_get_hash_pblock'
  mhash.c.text+0x82): undefined reference to `mhash_hmac_init'
  mhash.c.text+0x9c): undefined reference to `mhash'
  mhash.c.text+0xa8): undefined reference to `mhash_hmac_end'
  mhash.c.text+0xf9): undefined reference to `mhash_get_block_size'
  collect2: error: ld returned 1 exit status
  </code></pre>