summaryrefslogtreecommitdiff
path: root/libcryptohash/test/util.myr
blob: ceb411c9e59d5162cdb2dff43d7bc73c8cd7e8e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use std

pkg =
	const hasheq	: (got : byte[:], expected : byte[:] -> void)
;;

const hasheq = {got, expected
	var sb, str

	sb = std.mksb()
	for x in 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)
}