]> wimlib.net Git - wimlib/blob - src/sha1.h
e73b62a87881ad16f1ae19d1ce6cd0e33d6b5677
[wimlib] / src / sha1.h
1 #ifndef _WIMLIB_SHA1_H
2 #define _WIMLIB_SHA1_H
3
4 #include "config.h"
5 #include <stdio.h>
6 #include <stddef.h>
7
8 /* Compute SHA1 message digest for bytes read from STREAM.  The
9    resulting message digest number will be written into the 20 bytes
10    beginning at RESBLOCK.  */
11 extern int sha1_stream(FILE * stream, void *resblock);
12
13 #ifdef WITH_LIBCRYPTO
14 #include <openssl/sha.h>
15 static inline void *sha1_buffer(const char *buffer, size_t len, void *resblock)
16 {
17         return SHA1(buffer, len, resblock);
18 }
19 #else
20 /* Compute SHA1 message digest for LEN bytes beginning at BUFFER.  The
21    result is always in little endian byte order, so that a byte-wise
22    output yields to the wanted ASCII representation of the message
23    digest.  */
24 extern void *sha1_buffer(const char *buffer, size_t len, void *resblock);
25 #endif
26
27
28 #endif /* _WIMLIB_SHA1_H */