| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <refentry id="refhash">
- <refmeta>
- <refentrytitle>ne_strhash</refentrytitle>
- <manvolnum>3</manvolnum>
- </refmeta>
- <refnamediv>
- <refname id="ne_strhash">ne_strhash</refname>
- <refname id="ne_vstrhash">ne_vstrhash</refname>
- <refpurpose>string hash interface</refpurpose>
- </refnamediv>
-
- <refsynopsisdiv>
- <funcsynopsis>
- <funcsynopsisinfo>#include <ne_string.h></funcsynopsisinfo>
- <funcprototype>
- <funcdef>char *<function>ne_strhash</function></funcdef>
- <paramdef>unsigned int <parameter>flags</parameter></paramdef>
- <paramdef><parameter>...</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>char *<function>ne_vstrhash</function></funcdef>
- <paramdef>unsigned int <parameter>flags</parameter></paramdef>
- <paramdef>va_list <parameter>ap</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- </refsynopsisdiv>
- <refsect1>
- <title>Description</title>
- <para>The <function>ne_strhash</function> and
- <function>ne_vstrhash</function> functions can be used to
- create hashes. The varargs argument list must be <type>const
- char *</type> strings followed by a &null; terminator. The
- <parameter>flags</parameter> argument must select exactly one
- hash algorithm from the list below, which can be optionally
- bitwise-ORed with one of the formatting option. The hash is
- calculated for the concatenation of the argument list, without
- separators.</para>
- <refsect2>
- <title>Hash algorithms</title>
-
- <para>The following hash algorithms are available:
- <variablelist>
- <varlistentry>
- <term><constant>NE_HASH_MD5</constant></term>
- <listitem><simpara>MD5</simpara></listitem>
- </varlistentry>
- <varlistentry>
- <term><constant>NE_HASH_SHA256</constant></term>
- <listitem><simpara>SHA-256 (SHA-2)</simpara></listitem>
- </varlistentry>
- <varlistentry>
- <term><constant>NE_HASH_SHA512</constant></term>
- <listitem><simpara>SHA-512 (SHA-2)</simpara></listitem>
- </varlistentry>
- <varlistentry>
- <term><constant>NE_HASH_SHA256_256</constant></term>
- <listitem><simpara>SHA-512/256 (SHA-2)</simpara></listitem>
- </varlistentry>
- </variablelist>
- </para></refsect2>
-
- <refsect2>
- <title>Formatting options</title>
-
- <para>By default, the hash is returned as a hexadecimal
- lower-case character string. The following formatting
- options are available:
-
- <variablelist>
- <varlistentry>
- <term><constant>NE_HASH_COLON</constant></term>
- <listitem><simpara>colon-separated hex pairs, e.g. <literal>"aa:11:22..."</literal> </simpara></listitem>
- </varlistentry>
- <varlistentry>
- <term><constant>NE_HASH_SPACE</constant></term>
- <listitem><simpara>space-separated hex pairs, e.g. <literal>"aa 11 22..."</literal></simpara></listitem>
- </varlistentry>
- </variablelist></para>
- </refsect2>
-
- </refsect1>
- <refsect1>
- <title>Return value</title>
- <para>The return value is the ASCII hexadecimal representation
- of the hash as a malloc-allocated, NUL-terminated string, or
- &null; if the hash cannot be created. The string length is
- determined by the hash algorithm (and formatting options
- used). Support for hash algorithms is specific to the SSL
- toolkit with which &neon; is compiled. Some systems will
- further restrict hash availability at runtime, e.g. due to
- FIPS mode.</para>
- </refsect1>
- <refsect1>
- <title>History</title>
- <para><function>ne_strhash</function> and <function>ne_vstrhash</function> is
- available in &neon; 0.32.0 and later.</para>
- </refsect1>
- </refentry>
|