diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2010-07-09 12:32:17 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2010-07-09 12:32:17 +0200 |
commit | 6c027b4de25a529908be895e7ff19236f4002a57 (patch) | |
tree | f70d3a400bbb9ba8a83e9d4ffcaa4b6e367fc8bb /test.sh | |
download | crypto-6c027b4de25a529908be895e7ff19236f4002a57.zip crypto-6c027b4de25a529908be895e7ff19236f4002a57.tar.gz |
initial commit, resurrect one of my realy old projects
Diffstat (limited to 'test.sh')
-rwxr-xr-x | test.sh | 53 |
1 files changed, 53 insertions, 0 deletions
@@ -0,0 +1,53 @@ +#! /bin/sh + +FILE="test_file" +TMP="test_tmp" +KEY="secret_key_yeah_" # 16 bytes for twofish +BIN="./cryptot" + +if [ ! -x ${BIN} ]; then + echo "" && exit 1; +fi; + +# 80 Mb file +echo "generate a 70Mb file from source files." +if [ -f ${FILE} ]; then rm ${FILE}; fi; +if [ -f ${TMP} ]; then rm ${TMP}; fi; +cat *.c > ${FILE}; +cat ${FILE} >> ${TMP} && cat ${TMP} >> ${FILE} && cat ${FILE} >> ${TMP} && cat ${TMP} >> ${FILE} && \ +cat ${FILE} >> ${TMP} && cat ${TMP} >> ${FILE} && cat ${FILE} >> ${TMP} && cat ${TMP} >> ${FILE} && \ +cat ${FILE} >> ${TMP} && cat ${TMP} >> ${FILE} && cat ${FILE} >> ${TMP} && cat ${TMP} >> ${FILE} && \ +cat ${FILE} >> ${TMP} && cat ${TMP} >> ${FILE} || exit 1; +echo "done." +rm ${TMP} + +ARGS1="-v -c 1 -n 700 " +ARGS2="-v -x -c 1 -n 600 " +ARGSD="-d 127.0.0.1:4779" +ARGSS="-s 127.0.0.1:4779" + +local(){ + + cat ${FILE} | ${BIN} ${ARGS1} ${KEY} | ${BIN} -x ${ARGS2} ${KEY} > DEC +} + +dist (){ + + ${BIN} -x ${ARGS2} ${ARGSS} ${KEY} > DEC & PID=$! + sleep 2 + cat ${FILE} | ${BIN} ${ARGS1} ${ARGSD} ${KEY} || ( echo "error !!"; exit 1 ) + wait ${PID} +} + +local +echo "running diff" +diff ${FILE} DEC || echo "ERROR" +echo "OK." +rm DEC + +dist +echo "running diff" +diff ${FILE} DEC || echo "ERROR" +echo "OK." + +rm DEC ${FILE} |