source: trunk/test/testhash.sh@ 11

Last change on this file since 11 was 1, checked in by katerina, 19 years ago

Initial import

File size: 2.6 KB
Line 
1#! /bin/sh
2
3
4# The following two are the ANSI sequences for start and end embolden
5case $TERM in
6vt*|ansi*|con*|xterm*|linux*|screen*)
7 S=[1m
8 E=[m
9 ;;
10*)
11 S=
12 E=
13 ;;
14esac
15
16PW_DIR=`pwd`
17
18if test x$UID != x; then
19 TRUST="--with-trusted=0,2,$UID"
20else
21 TRUST="--with-trusted=0,2"
22fi
23
24#echo; echo "${S}__ STARTING TEST HASH FUNCTION __${E}"; echo;
25#echo Working directory: $PW_DIR
26
27MAKE=`which gmake`
28if test "x$?" = x1 ; then
29 MAKE="make -s"
30else
31 MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"`
32 if test "x$MAKE" = x; then
33 MAKE="make -s"
34 elif test "x$MAKE" = xno; then
35 MAKE="make -s"
36 else
37 if test "x$MAKE" = "xwhich:"; then
38 MAKE="make -s"
39 else
40 MAKE="gmake -s"
41 gmake -v >/dev/null 2>&1 || MAKE="make -s"
42 fi
43 fi
44fi
45
46
47
48testhash ()
49{
50 #
51 # test standalone compilation
52 #
53 TEST="${S}standalone agent${E}"
54 #
55 if test -r "Makefile"; then
56 $MAKE distclean
57 fi
58 #
59 ${TOP_SRCDIR}/configure --quiet --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test > /dev/null 2>> test_log
60 #
61 if test x$? = x0; then
62 echo "PASS: configure ${TEST}";
63 $MAKE > /dev/null 2>> test_log
64 if test x$? = x0; then
65 echo "PASS: $MAKE ${TEST}";
66 else
67 echo "FAIL: $MAKE ${TEST} (see ./test_log)";
68 fi
69 else
70 echo "FAIL: configure ${TEST} (see ./test_log)";
71 fi
72
73 echo "Test results of the TIGER hash algorithm" > testhash.tmp
74 echo >> testhash.tmp
75 echo "(use samhain -H string to test)" >> testhash.tmp
76 echo >> testhash.tmp
77 ./samhain -H "" >> testhash.tmp
78 ./samhain -H "abc" >> testhash.tmp
79 ./samhain -H "Tiger" >> testhash.tmp
80 ./samhain -H "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-" >> testhash.tmp
81 ./samhain -H "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789" >> testhash.tmp
82 ./samhain -H "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham" >> testhash.tmp
83 ./samhain -H "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham, proceedings of Fast Software Encryption 3, Cambridge." >> testhash.tmp
84 ./samhain -H "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham, proceedings of Fast Software Encryption 3, Cambridge, 1996." >> testhash.tmp
85 ./samhain -H "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-" >> testhash.tmp
86
87 # echo
88 # echo "${S}diff testhash.tmp testtiger.txt (empty == success):${E}"
89 # echo
90 RESU=`diff testhash.tmp ${SCRIPTDIR}/testtiger.txt`
91 if test "x${RESU}" = "x"; then
92 echo "PASS: test_hash"
93 else
94 echo "FAIL: test_hash"
95 fi
96}
97
98
99
100 testhash
101
102
103#echo; echo "${S}__ END TEST HASH FUNCTION __${E}"; echo;
104
105exit
106
Note: See TracBrowser for help on using the repository browser.