xref: /freebsd/sys/contrib/libsodium/src/libsodium/include/sodium/crypto_hash.h (revision 3611ec604864a7d4dcc9a3ea898c80eb35eef8a0)
1 #ifndef crypto_hash_H
2 #define crypto_hash_H
3 
4 /*
5  * WARNING: Unless you absolutely need to use SHA512 for interoperatibility,
6  * purposes, you might want to consider crypto_generichash() instead.
7  * Unlike SHA512, crypto_generichash() is not vulnerable to length
8  * extension attacks.
9  */
10 
11 #include <stddef.h>
12 
13 #include "crypto_hash_sha512.h"
14 #include "export.h"
15 
16 #ifdef __cplusplus
17 # ifdef __GNUC__
18 #  pragma GCC diagnostic ignored "-Wlong-long"
19 # endif
20 extern "C" {
21 #endif
22 
23 #define crypto_hash_BYTES crypto_hash_sha512_BYTES
24 SODIUM_EXPORT
25 size_t crypto_hash_bytes(void);
26 
27 SODIUM_EXPORT
28 int crypto_hash(unsigned char *out, const unsigned char *in,
29                 unsigned long long inlen);
30 
31 #define crypto_hash_PRIMITIVE "sha512"
32 SODIUM_EXPORT
33 const char *crypto_hash_primitive(void)
34             __attribute__ ((warn_unused_result));
35 
36 #ifdef __cplusplus
37 }
38 #endif
39 
40 #endif
41