summaryrefslogtreecommitdiff
path: root/lib/crypto/test/sha1.myr
diff options
context:
space:
mode:
Diffstat (limited to 'lib/crypto/test/sha1.myr')
-rw-r--r--lib/crypto/test/sha1.myr15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/crypto/test/sha1.myr b/lib/crypto/test/sha1.myr
index e750f41..75361f8 100644
--- a/lib/crypto/test/sha1.myr
+++ b/lib/crypto/test/sha1.myr
@@ -1,8 +1,6 @@
use std
use crypto
-use "util"
-
const main = {
hasheq(crypto.sha1("")[:], \
"da39a3ee5e6b4b0d3255bfef60951890d8af0709")
@@ -16,3 +14,16 @@ const main = {
"4eb17e52bb55910b037869438f69d9c87643d75a")
}
+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)
+}