shithub: mc

ref: 34a0fe0d51a0bf0679d2d3b4c09140c8447dac2c
dir: /lib/crypto/util.myr/

View raw version
use std

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

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.eq(str, expected))
		std.fatal("mismatched hashes:\n\tgot:\t{}\n\texpected:\t{}\n", str, expected)
	;;
	std.slfree(str)
}