Merge remote-tracking branch 'boock/master'
[paraslash.git] / sha1.c
1 /*
2 * Copyright (C) 2007-2011 Andre Noll <maan@systemlinux.org>
3 *
4 * Licensed under the GPL v2. For licencing details see COPYING.
5 */
6
7 /** \file sha1.c Secure Hash Algorithm, provided by openssl. */
8
9 #include "para.h"
10 #include <openssl/sha.h>
11
12 /**
13 * Compute the sha1 hash.
14 *
15 * \param data Pointer to the data to compute the hash value from.
16 * \param len The length of \a data in bytes.
17 * \param sha1 Result pointer.
18 *
19 * \a sha1 must point to an area at least 20 bytes large.
20 *
21 * \sa sha(3), openssl(1).
22 * */
23 void sha1_hash(const char *data, unsigned long len, unsigned char *sha1)
24 {
25 SHA_CTX c;
26 SHA1_Init(&c);
27 SHA1_Update(&c, data, len);
28 SHA1_Final(sha1, &c);
29 }