From ac9e817adc64b431d57d6353ca7648f6b2b06f90 Mon Sep 17 00:00:00 2001 From: CyberLeo Date: Sun, 10 Mar 2013 16:09:15 -0500 Subject: [PATCH] FreeBSD has a cksum binary that may be useful --- flag | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/flag b/flag index aac454d..68cb2b1 100755 --- a/flag +++ b/flag @@ -38,15 +38,16 @@ find_crc32_bin() { if [ -z "${crc32}" ] then - for bin in ruby php perl + for bin in cksum ruby php perl do bin="$(which "${bin}" 2>/dev/null)" if [ -x "${bin}" ] then case "${bin}" in - */ruby) bin="${bin} -e 'require \"zlib\"; printf(\"%08x\n\", Zlib.crc32(STDIN.readlines.join))'" ;; - */php) bin="${bin} -r 'printf(\"%08x\n\", crc32(file_get_contents(\"/dev/stdin\")));'" ;; - */perl) bin="${bin} -e 'use String::CRC32; printf(\"%08x\n\", crc32(*STDIN));'" ;; + */cksum) bin="printf '%08x\n' \$(${bin} -o 3) | head -n 1" ;; + */ruby) bin="${bin} -e 'require \"zlib\"; printf(\"%08x\n\", Zlib.crc32(STDIN.readlines.join))'" ;; + */php) bin="${bin} -r 'printf(\"%08x\n\", crc32(file_get_contents(\"/dev/stdin\")));'" ;; + */perl) bin="${bin} -e 'use String::CRC32; printf(\"%08x\n\", crc32(*STDIN));'" ;; esac export crc32_bin="${bin}" if [ "$(hash_string "meow" 2>/dev/null)" = "8a106afe" ] -- 2.42.0