summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-05-30 10:24:04 -0400
committerOri Bernstein <ori@eigenstate.org>2015-08-24 22:10:06 -0700
commitbf8b4ecc51a8adc0eee50424f5e1a13f3a20452e (patch)
tree2eda9dbbdf3f8ba1132b978f946530dcadeaec85
parent96c22e7e846b1aecc6acbf75b15eedf53923fdd1 (diff)
downloadmc-bf8b4ecc51a8adc0eee50424f5e1a13f3a20452e.tar.gz
Add test source for sha1.
Oops. Forgot.
-rw-r--r--libcryptohash/test/sha1-test.myr22
1 files changed, 22 insertions, 0 deletions
diff --git a/libcryptohash/test/sha1-test.myr b/libcryptohash/test/sha1-test.myr
new file mode 100644
index 0000000..f4ac0f1
--- /dev/null
+++ b/libcryptohash/test/sha1-test.myr
@@ -0,0 +1,22 @@
+use std
+use cryptohash
+
+const main = {
+ print(cryptohash.sha1(""))
+ print(cryptohash.sha1("h"))
+ /* 64 byte block */
+ print(cryptohash.sha1("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"))
+ /* tail spanning */
+ print(cryptohash.sha1("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbb"))
+}
+
+const print = {b
+ for x in b
+ if (x <= 0xf)
+ std.put("0%xb", x)
+ else
+ std.put("%xb", x)
+ ;;
+ ;;
+ std.put("\n")
+}