title: How to use SHA1 hashing in C programming
body: <p>I am trying to write a C program that proves SHA1 is nearly collision free, but I cannot figure out how to actually create the hash for my input values.  I just need to create the hash, and store the hex value into an array.  After some Google searches, I've found OpenSSL documentation directing me to use this:</p>
  
  <pre><code> #include &lt;openssl/sha.h&gt;
  
   unsigned char *SHA1(const unsigned char *d, unsigned long n,
                    unsigned char *md);
  
   int SHA1_Init(SHA_CTX *c);
   int SHA1_Update(SHA_CTX *c, const void *data,
                    unsigned long len);
   int SHA1_Final(unsigned char *md, SHA_CTX *c);
  </code></pre>
  
  <p>I believe I should be using either unsigned char *SHA1 or SHA1_Init, but I am not sure what the arguments would be, given x is my input to be hashed.  Would someone please clear this up for me?  Thanks.</p>