Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2006 Pekka Riikonen
+ Copyright (C) 1997 - 2007 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
*
* Basic has function to hash strings. May be used with the SilcHashTable.
* Note that this lowers the characters of the string (with tolower()) so
- * this is used usually with nicknames, channel and server names to provide
- * case insensitive keys.
+ * this can be used to provide case-insensitive hashing.
*
***/
SilcUInt32 silc_hash_string(void *key, void *user_context);
***/
SilcUInt32 silc_hash_data(void *key, void *user_context);
-/****f* silcutil/SilcUtilAPI/silc_hash_public_key
- *
- * SYNOPSIS
- *
- * SilcUInt32 silc_hash_public_key(void *key, void *user_context);
- *
- * DESCRIPTION
- *
- * Hash public key of any type.
- *
- ***/
-SilcUInt32 silc_hash_public_key(void *key, void *user_context);
-
/****f* silcutil/SilcUtilAPI/silc_hash_string_compare
*
* SYNOPSIS
*
* DESCRIPTION
*
- * Compares two strings. It may be used as SilcHashTable comparison
- * function.
+ * Compares two strings. This ignores the case while comparing. It may
+ * be used as SilcHashTable comparison function.
*
***/
SilcBool silc_hash_string_compare(void *key1, void *key2, void *user_context);
***/
SilcBool silc_hash_utf8_compare(void *key1, void *key2, void *user_context);
-/****f* silcutil/SilcUtilAPI/silc_hash_public_key_compare
- *
- * SYNOPSIS
- *
- * SilcBool silc_hash_public_key_compare(void *key1, void *key2,
- * void *user_context);
- *
- * DESCRIPTION
- *
- * Compares two SILC Public keys. It may be used as SilcHashTable
- * comparison function.
- *
- ***/
-SilcBool silc_hash_public_key_compare(void *key1, void *key2,
- void *user_context);
-
/****f* silcutil/SilcUtilAPI/silc_fingerprint
*
* SYNOPSIS
* each copied list.
*
***/
-void silc_va_copy(va_list dest, va_list src);
+#if defined(HAVE_VA_COPY)
+#define silc_va_copy(dest, src) va_copy(dest, src);
+#elif defined(HAVE___VA_COPY)
+#define silc_va_copy(dest, src) __va_copy(dest, src);
+#elif defined(SILC_VA_COPY_ARRAY)
+#define silc_va_copy(dest, src) memmove(dest, src, sizeof(va_list));
+#else
+#define silc_va_copy(dest, src) dest = src;
+#endif
+
+/****f* silcutil/SilcUtilAPI/silc_hexdump
+ *
+ * SYNOPSIS
+ *
+ * void silc_hexdump(const unsigned char *data, SilcUInt32 data_len,
+ * FILE *output);
+ *
+ * DESCRIPTION
+ *
+ * Dumps the `data' of length of `data_len' bytes as HEX. The `output'
+ * file specifies the destination.
+ *
+ ***/
+void silc_hexdump(const unsigned char *data, SilcUInt32 data_len,
+ FILE *output);
+
+/****f* silcutil/SilcUtilAPI/silc_hex2data
+ *
+ * SYNOPSIS
+ *
+ * SilcBool silc_hex2data(const char *hex, unsigned char *data,
+ * SilcUInt32 data_size, SilcUInt32 *ret_data_len);
+ *
+ * DESCRIPTION
+ *
+ * Converts HEX character string to binary data. Each HEX numbers must
+ * have two characters in the `hex' string.
+ *
+ ***/
+SilcBool silc_hex2data(const char *hex, unsigned char *data,
+ SilcUInt32 data_size, SilcUInt32 *ret_data_len);
+
+/****f* silcutil/SilcUtilAPI/silc_data2hex
+ *
+ * SYNOPSIS
+ *
+ * SilcBool silc_data2hex(const unsigned char *data, SilcUInt32 data_len,
+ * char *hex, SilcUInt32 hex_size);
+ *
+ * DESCRIPTION
+ *
+ * Converts binary data to HEX string. This NULL terminates the `hex'
+ * buffer automatically.
+ *
+ ***/
+SilcBool silc_data2hex(const unsigned char *data, SilcUInt32 data_len,
+ char *hex, SilcUInt32 hex_size);
#endif /* !SILCUTIL_H */