X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=bin%2Fmeta4ra-hashes-detect;fp=bin%2Fmeta4ra-hashes-detect;h=20d48150f13f840e8085f3c1b1c0535d88766f93;hb=be69a4fc0c240c2772a0f0bf0955b39783e4c48a;hp=0000000000000000000000000000000000000000;hpb=ce902a58a32f42801603475c67dd75da86d4502a;p=meta4ra.git diff --git a/bin/meta4ra-hashes-detect b/bin/meta4ra-hashes-detect new file mode 100755 index 0000000..20d4815 --- /dev/null +++ b/bin/meta4ra-hashes-detect @@ -0,0 +1,67 @@ +#!/bin/sh -e + +hw="hello world" +hashes="" + +desired="$1" + +check() { + local name="$1" + if [ -n "$desired" ] && [ $desired != "$name" ] ; then return 1 ; fi + local cmd="$2" + local hsh="$3" + our=$(echo -n hello world | sh -e -c "$cmd" | { read h rem ; printf %s "$h"; }) + [ $hsh = "$our" ] && hashes="$hashes,$name:$cmd" +} + +hsh=d74981efa70a0c880b8d8c1985d075dbcbf679b99a5f9914e5aaf96b831a9e24 +check blake3-256 b3sum $hsh || : + +hsh=021ced8799296ceca557832ab941a50b4a11f83478cf141f51f933f653ab9fbcc05a037cddbed06e309bf334942c4e58cdf1a46e237911ccd7fcf9787cbc7fd0 +check blake2b-512 b2sum $hsh || +check blake2b-512 "openssl blake2b512 -r" $hsh || : + +hsh=256c83b297114d201b30179f3f0ef0cace9783622da5974326b436178aeef610 +check blake2b-256 "b2sum -l 256" $hsh || : + +hsh=8b4830244fc36daa11177311dc6bf7636376180dce2d29193335878142e7d6f5e9016beba729e0a353dd2fd421c8b2022ee8927f0bce6b88631bb01be2e0f5ba +check skein-512 skein512 $hsh || : + +hsh=3a9159f071e4dd1c8c4f968607c30942e120d8156b8b1e72e0d376e8871cb8b8 +check shake128 goshake128 $hsh || # go.stargrave.org/gosha3 +check shake128 "sha3sum -a 128000 | dd bs=1 count=64 2> /dev/null" $hsh || : # p5-Digest-SHA3 +# openssl shake128 -- useless, as it outputs only 128 bits + +hsh=369771bb2cb9d2b04c1d54cca487e372d9f187f73f7ba3f65b95c8ee7798c527f4f3c2d55c2d46a29f2e945d469c3df27853a8735271f5cc2d9e889544357116 +check shake256 goshake256 $hsh || +check shake256 "sha3sum -a 256000 | dd bs=1 count=128 2> /dev/null" $hsh || : + +hsh=309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee511a7c7a9bcd3ca86d4cd86f989dd35bc5ff499670da34255b45b0cfd830e81f605dcf7dc5542e93ae9cd76f +check sha-512 sha512 $hsh || +check sha-512 sha512sum $hsh || +check sha-512 "libressl dgst -sha512" $hsh || +check sha-512 "openssl sha512 -r" $hsh || : + +hsh=b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9 +check sha-256 sha256 $hsh || +check sha-256 sha256sum $hsh || +check sha-256 "libressl dgst -sha256" $hsh || +check sha-256 "openssl sha256 -r" $hsh || : + +hsh=84d883ede9fa6ce855d82d8c278ecd9f5fc88bf0602831ae0c38b9b506ea3cb02f3fa076b8f5664adf1ff862c0157da4cc9a83e141b738ff9268a9ba3ed6f563 +check streebog-512 "nettle-hash --algorithm=streebog512 --raw | xxd -c 0 -p" $hsh || +check streebog-512 "nettle-hash --algorithm=streebog512 --raw | hexdump -v -e '/1 \"%02x\"' ; echo" $hsh || +check streebog-512 "libressl dgst -streebog512" $hsh || +check streebog-512 streebog512 $hsh || : # go.cypherpunks.ru/gogost + +hsh=c600fd9dd049cf8abd2f5b32e840d2cb0e41ea44de1c155dcd88dc84fe58a855 +check streebog-256 "nettle-hash --algorithm=streebog256 --raw | xxd -c 0 -p" $hsh || +check streebog-256 "nettle-hash --algorithm=streebog256 --raw | hexdump -v -e '/1 \"%02x\"' ; echo" $hsh || +check streebog-256 "libressl dgst -streebog256" $hsh || +check streebog-256 streebog256 $hsh || : + +hsh=df8d09e93f874900a99b8775cc15b6c7 +check xxh3-128 "xxhsum -H128" $hsh || : + +[ -n "$hashes" ] +echo ${hashes#,}