summaryrefslogtreecommitdiffstats
path: root/source/rainerscript/functions/mo-hashXX.rst
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/rainerscript/functions/mo-hashXX.rst42
1 files changed, 42 insertions, 0 deletions
diff --git a/source/rainerscript/functions/mo-hashXX.rst b/source/rainerscript/functions/mo-hashXX.rst
new file mode 100644
index 0000000..61bb69a
--- /dev/null
+++ b/source/rainerscript/functions/mo-hashXX.rst
@@ -0,0 +1,42 @@
+******
+HashXX
+******
+
+Purpose
+=======
+
+Generates hash for a given string.
+
+hash32(literal_string) / hash32(literal_string, seed)
+-----------------------------------------------------
+
+ Generates a 32 bit hash of the given string.
+ - Seed is an optional parameter with default = 0.
+ - If seed is not a valid number, then 0 is returned.
+
+hash64(literal_string) / hash64(literal_string, seed)
+-----------------------------------------------------
+
+ Generates a 64 bit hash of the given string.
+ - Seed is an optional parameter with default = 0.
+ - If seed is not a valid number, then 0 is returned.
+
+.. warning::
+
+ - Default hash implementation is non-crypto.
+ - To use xxhash enable compile time flag.
+
+
+Example
+=======
+
+.. code-block:: none
+
+ module(load="fmhash")
+
+ set $.hash = hash64($!msg!field_1 & $!msg!field_2 & $!msg!field_3)
+ set $!tag= $syslogtag & $.hash;
+ //send out
+
+.. seealso::
+ :doc:`Hash based sampling<../../tutorials/hash_sampling>`