1NE_STRHASH(3) neon API reference NE_STRHASH(3)
2
3
4
6 ne_strhash, ne_vstrhash - string hash interface
7
9 #include <ne_string.h>
10
11 char *ne_strhash(unsigned int flags, ...);
12
13 char *ne_vstrhash(unsigned int flags, va_list ap);
14
16 The ne_strhash and ne_vstrhash functions can be used to create hashes.
17 The varargs argument list must be const char * strings followed by a
18 NULL terminator. The flags argument must select exactly one hash
19 algorithm from the list below, which can be optionally bitwise-ORed
20 with one of the formatting option. The hash is calculated for the
21 concatenation of the argument list, without separators.
22
23 Hash algorithms
24 The following hash algorithms are available:
25
26 NE_HASH_MD5
27 MD5
28
29 NE_HASH_SHA256
30 SHA-256 (SHA-2)
31
32 NE_HASH_SHA512
33 SHA-512 (SHA-2)
34
35 NE_HASH_SHA256_256
36 SHA-512/256 (SHA-2)
37
38 Formatting options
39 By default, the hash is returned as a hexadecimal lower-case character
40 string. The following formatting options are available:
41
42 NE_HASH_COLON
43 colon-separated hex pairs, e.g. "aa:11:22..."
44
45 NE_HASH_SPACE
46 space-separated hex pairs, e.g. "aa 11 22..."
47
49 The return value is the ASCII hexadecimal representation of the hash as
50 a malloc-allocated, NUL-terminated string, or NULL if the hash cannot
51 be created. The string length is determined by the hash algorithm (and
52 formatting options used). Support for hash algorithms is specific to
53 the SSL toolkit with which neon is compiled. Some systems will further
54 restrict hash availability at runtime, e.g. due to FIPS mode.
55
57 Joe Orton
58 Author.
59
61neon 0.32.5 21 January 2023 NE_STRHASH(3)