dccp_recv.c: Fix a fd leak.
[paraslash.git] / sha1.c
1 #include "para.h"
2 #include <openssl/sha.h>
3
4 /** \file sha1.c Secure Hash Algorithm, provided by openssl. */
5
6 /**
7 * Compute the sha1 hash.
8 *
9 * \param data Pointer to the data to compute the hash value from.
10 * \param len The length of \a data in bytes.
11 * \param sha1 Result pointer
12 *
13 * \a sha1 must point to an area at least 20 bytes large.
14 *
15 * \sa sha(3), openssl(1).
16 * */
17 void sha1_hash(const char *data, unsigned long len, unsigned char *sha1)
18 {
19 SHA_CTX c;
20 SHA1_Init(&c);
21 SHA1_Update(&c, data, len);
22 SHA1_Final(sha1, &c);
23 }