test.sh (495B)
1 #!/usr/bin/env zsh 2 3 error=0 4 while read line; do 5 pass=`cut -f1 <<<$line` 6 salt=`cut -f2 <<<$line` 7 iter=`cut -f3 <<<$line` 8 keylen=`cut -f4 <<<$line` 9 expected=`cut -f5 <<<$line` 10 hexsalt=`cut -f6 <<<$line` 11 #TODO: check! 12 derived=`./pbkdf2 $hexsalt $iter $keylen <<<$pass` 13 if [[ $derived != $expected ]]; then 14 echo ./pbkdf2 $hexsalt $iter $keylen "<<<$pass" 15 echo "Expected $expected, got $derived" >&2 16 error=$((error + 1)) 17 fi 18 done < test.txt 19 20 if [[ $error == 1 ]]; then 21 exit $error 22 fi