#!/bin/sh # Checking SHA256 message digests for 01x-05x tests . $(dirname $0)/../test_library script_path=$(pwd) result=0 test_nr=6 for file in ${script_path}/../logs/sha256sum/*.* do name="${file##*/}" case $name in "cat.log") filetype=CAT; format_nr=1 ;; "msi.log") filetype=MSI; format_nr=2 ;; "ex_.log") filetype=CAB; format_nr=3 ;; "exe.log") filetype=PE; format_nr=4 ;; "ps1.log") filetype=TXT; format_nr=5 ;; esac number="$test_nr$format_nr" test_name="Checking SHA256 message digests for a $filetype file test" printf "\n%03d. %s\n" "$number" "$test_name" if test $(cat "sha256sum/$name" | cut -d' ' -f1 | uniq | wc -l) -ne 1 then result=1 cat "sha256sum/$name" >> "results.log" printf "Non-unique SHA256 message digests found\n" >> "results.log" fi rm -f "sha256sum/$name" test_result "$result" "$number" "$test_name" done exit 0