summaryrefslogtreecommitdiff
path: root/lib/crypto/test/md5.myr
diff options
context:
space:
mode:
Diffstat (limited to 'lib/crypto/test/md5.myr')
-rw-r--r--lib/crypto/test/md5.myr15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/crypto/test/md5.myr b/lib/crypto/test/md5.myr
index bc0939f..380c531 100644
--- a/lib/crypto/test/md5.myr
+++ b/lib/crypto/test/md5.myr
@@ -1,8 +1,6 @@
use std
use crypto
-use "util"
-
const main = {
hasheq(crypto.md5("")[:], \
"d41d8cd98f00b204e9800998ecf8427e")
@@ -16,3 +14,16 @@ const main = {
"3b0bb4c5ece4a6568caa7266e740a140")
}
+const hasheq = {got, expected
+ var sb, str
+
+ sb = std.mksb()
+ for x : got
+ std.sbfmt(sb, "{p=0,w=2,x}", x)
+ ;;
+ str = std.sbfin(sb)
+ if (!std.sleq(str, expected))
+ std.fatal("mismatched hashes:\n\tgot:\t{}\n\texpected:\t{}\n", str, expected)
+ ;;
+ std.slfree(str)
+}