Goal: Test MD5 and SHA1 hash functions from the math module.
ruleset a60x483 {
meta {
name "testing-hash-stuff"
description <<
testing-hash-stuff
>>
author "Mike Grace"
logging on
}
rule hash_functions {
select when pageview ".*"
pre {
r = math:random(999);
md5 = math:md5(r);
sha1 = math:sha1(r);
displayHtml =<<
<p>Random Number: #{r}</p>
<p>md5 of r: #{md5}</p>
<p>sha1 of r: #{sha1}</p>
>>;
}
{
append("body", displayHtml);
}
}
}
- 14 generate random number from 0 to 998
- 15 generate MD5 hash of random number
- 16 generate SHA1 hash of random number
- 17-21 here docs are awesome!
App run on example.com using bookmarklet:
Get the bookmarklet to try it out yourself!
Gratuitous day 5 crazy face

