shithub: mc

ref: 4ab9c0f5b96c84329a887f7fdbba92066c8ad7a7
dir: /libcryptohash/test/sha1-test.myr/

View raw version
use std
use cryptohash

const main = {
	print(cryptohash.sha1(""))
	print(cryptohash.sha1("h"))
	/* 64 byte block */
	print(cryptohash.sha1("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"))
	/* tail spanning */
	print(cryptohash.sha1("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbb"))
}

const print = {b
	for x in b
		if (x <= 0xf)
			std.put("0%xb", x)
		else
			std.put("%xb", x)
		;;
	;;
        std.put("\n")
}