1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- #parse argument
- architecture=$1
- permutation=$2
- matrix_decompressed_file=$3
- matrix_comp_file=$4
- output_dir=$5
- lorem_ipsum_file=$6
- if [ $permutation -eq 0 ] ; then
- permutation_str=""
- else
- permutation_str=" -no-permutation-key "
- fi
- # make hash
- str="
- xrnlib-cli \
- --decoding-conf -compiled-param -no-password \
- --encoding-conf -compiled-param -no-password \
- --sequence-conf -xmatrix $matrix_decompressed_file \
- --permutation-conf -arch $architecture $permutation_str \
- --make-hash -plain-text $lorem_ipsum_file -hash $output_dir/hash.xf
- "
- echo ""; echo $str; echo ""
- eval $str
- # check hash
- str="
- xrnlib-cli \
- --decoding-conf -compiled-param -no-password \
- --encoding-conf -compiled-param -no-password \
- --arithmetic-conf -hash $output_dir/hash.xf \
- --sequence-conf -xmatrix $matrix_decompressed_file \
- --permutation-conf -arch $architecture \
- --logging-conf -lib-info-log $output_dir/lib_info_log_file.xf \
- --check-hash -plain-text $lorem_ipsum_file
- "
- echo ""; echo $str; echo ""
- eval $str
- str="
- if ! [ -s $output_dir/lib_info_log_file.xf ]; then echo FAIL ; exit ; fi ; \
- if grep -q FAIL \"$output_dir/lib_info_log_file.xf\" ; then echo FAIL ; exit ; fi
- "
- echo ""; echo $str; echo ""
- eval $str
- # generate wrong file
- str="
- cp $lorem_ipsum_file $output_dir/wrong_lorem_ipsum ; echo "a" >> $output_dir/wrong_lorem_ipsum ;
- "
- echo ""; echo $str; echo ""
- eval $str
- # check hash
- str="
- xrnlib-cli \
- --decoding-conf -compiled-param -no-password \
- --encoding-conf -compiled-param -no-password \
- --arithmetic-conf -hash $output_dir/hash.xf \
- --sequence-conf -xmatrix $matrix_decompressed_file \
- --permutation-conf -arch $architecture \
- --logging-conf -lib-info-log $output_dir/wrong_lib_info_log_file.xf \
- --check-hash -plain-text $output_dir/wrong_lorem_ipsum
- "
- echo ""; echo $str; echo ""
- eval $str
- str="
- if ! [ -s $output_dir/wrong_lib_info_log_file.xf ]; then echo FAIL ; exit ; fi ; \
- if grep -q PASS \"$output_dir/wrong_lib_info_log_file.xf\" ; then echo FAIL ; exit ; fi
- "
- echo ""; echo $str; echo ""
- eval $str
|