DataScript: avi.utils.murmur_hash (), avi.utils.sha1_hash (), avi.utils.md5_hash ()

Functions avi.utils.murmur_hash ( string ),
avi.utils.sha1_hash ( string ),
avi.utils.md5_hash ( string )
Description Starting with Avi Vantage 17.1.10 and 17.2.3, DataScripts can hash arbitrary data using one of three functions supporting their correspondingly named hashing methods: MurmurHash, SHA-1, and MD5.
Events HTTP_REQ
HTTP_RESP
Parameter string is the string to be hashed.
Returns The hashed string
Example Consider this 5-line code snippet:

if avi.http.get_path() == "/echo_listen_port" then
 avi.vs.log("Murmur-hash = " .. avi.utils.murmur_hash("How is the weather?"))
 avi.vs.log("SHA1-hash = " .. avi.utils.sha1_hash("How is the weather?"))
 avi.vs.log("MD5-hash = " .. avi.utils.md5_hash("How is the weather?"))
end
The output yielded for curl -vvv http://10.160.33.200/echo_listen_port was as follows:

[string "DS1"]:2: Murmur-hash = 2050936584
[string "DS1"]:3: SHA1-hash = 0171e8d98bf187af83fe7a9dbbb34ebc6629dcbe
[string "DS1"]:4: MD5-hash = c4150a2ad26a0c6345041f11ba914661

Updated: 2018-01-19 07:11:49 +0000