summaryrefslogtreecommitdiff
path: root/src/components/utils/include/utils/gen_hash.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/utils/include/utils/gen_hash.h')
-rw-r--r--src/components/utils/include/utils/gen_hash.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/components/utils/include/utils/gen_hash.h b/src/components/utils/include/utils/gen_hash.h
index e4102d36db..acb2e28a1d 100644
--- a/src/components/utils/include/utils/gen_hash.h
+++ b/src/components/utils/include/utils/gen_hash.h
@@ -37,6 +37,10 @@
namespace utils {
+namespace custom_string {
+class CustomString;
+}
+
/**
* @brief generate random alphanumeric string of specified length
* @param size length of random string
@@ -45,6 +49,32 @@ namespace utils {
const std::string gen_hash(size_t size);
+/**
+ * @brief Allows to generate hash from the specified string.
+ * The djb2 algorithm uses for hash generation.
+ * @param str_to_hash - the string from which hash should be generated.
+ * @return integer hash for the specified string.
+ */
+int32_t Djb2HashFromString(const std::string& str_to_hash);
+
+/**
+ * @brief Generates hash.
+ * The faq6 algorithm uses for hash generation.
+ * @param str_to_hash - the CustomSting contains ASCII or UTF8 string from which
+ * hash should be generated.
+ * @return uint32_t hash for the specified string.
+ */
+uint32_t CaseInsensitiveFaq6HashFromString(
+ const custom_string::CustomString& str_to_hash);
+
+/**
+ * @brief Transforms input string to lower case and then generates hash.
+ * The faq6 algorithm uses for hash generation.
+ * @param str_to_hash - the string from which hash should be generated.
+ * @return uint32_t hash for the specified string.
+ */
+uint32_t CaseInsensitiveFaq6HashFromString(const char* cstr);
+
} // namespace utils
#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_GEN_HASH_H_