Day 5 – MD5 and SHA1 hashing

Goal: Test MD5 and SHA1 hash functions from the math module.

ruleset a60x483 {
  meta {
    name "testing-hash-stuff"
    description <<
    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 using bookmarklet:

Get the bookmarklet to try it out yourself!

Gratuitous day 5 crazy face

This entry was posted in Kynetx and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s