Skip to content

Instantly share code, notes, and snippets.

@rsbohn
Created May 19, 2011 01:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsbohn/980000 to your computer and use it in GitHub Desktop.
Save rsbohn/980000 to your computer and use it in GitHub Desktop.
test hmac-sha1
ruleset a421x67 {
meta {
name "test-hmac-sha1"
description "Test hmac_sha1_base64(msg, key) function"
author "Randall Bohn"
logging on
}
dispatch {}
global {}
rule hmac_test {
select when pageview ".*"
pre {
msg = "GET\n\n\nWed, 28 Mar 2007 01:29:59 +0000\n/";
stkey = "uV3F3YluFJax1cknvbcGwgjvx4QpvB+leU8dUj2o";
expected = "Db+gepJSUbZKwpx1FR0DLtEYoZA=";
actual = math:hmac_sha1_base64(msg, stkey);
}
{
append("#main", "<div>Example from <a href='http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAuthentication.html'>AWS Docs</a></div>");
append("#main", "<div>expected: "+expected+"</div>");
append("#main", "<div>got: "+actual+"</div>");
}
}
}
@rsbohn
Copy link
Author

rsbohn commented May 19, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment