summaryrefslogtreecommitdiff
path: root/lib/crypto/test/sha256.myr
diff options
context:
space:
mode:
Diffstat (limited to 'lib/crypto/test/sha256.myr')
-rw-r--r--lib/crypto/test/sha256.myr15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/crypto/test/sha256.myr b/lib/crypto/test/sha256.myr
index 958b993..32142d1 100644
--- a/lib/crypto/test/sha256.myr
+++ b/lib/crypto/test/sha256.myr
@@ -1,8 +1,6 @@
use std
use crypto
-use "util"
-
const main = {
hasheq(crypto.sha224("")[:], \
"d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f")
@@ -27,3 +25,16 @@ const main = {
"bac8bf0f9794a520a5bf0ec64d3206edd1b9f2ef5ea118c9cad5365d84578de4")
}
+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)
+}