* Makefile.am: Reenable tests now that the Elgamal signature keys are
[gnupg.git] / checks / mds.test
1 #!/bin/sh
2
3
4 . $srcdir/defs.inc || exit 3
5
6
7 test_one () {
8    if [ "`grep $1 y | sed -e 's/:[^:]*:\(.*\):/\1/'`" != "$2" ]; then
9         failed="$failed $1"
10    fi
11 }
12
13 failed=""
14
15 #info Checking message digests
16 cat /dev/null | $GPG --with-colons --print-mds >y
17 # MD5
18 test_one ":1:"    "D41D8CD98F00B204E9800998ECF8427E"
19 # SHA-1
20 test_one ":2:"    "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709"
21 # RMD160
22 test_one ":3:"    "9C1185A5C5E9FC54612808977EE8F548B2258D31"
23 # SHA-256
24 if have_hash_algo "SHA256"; then
25   test_one ":8:"    "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855"
26 else
27   echo "Hash algorithm SHA-256 is not installed (not an error)"
28 fi
29 # SHA-384
30 if have_hash_algo "SHA384"; then
31   test_one ":9:"  "38B060A751AC96384CD9327EB1B1E36A21FDB71114BE07434C0CC7BF63F6E1DA274EDEBFE76F65FBD51AD2F14898B95B"
32 else
33   echo "Hash algorithm SHA-384 is not installed (not an error)"
34 fi
35 # SHA-512
36 if have_hash_algo "SHA512"; then
37   test_one ":10:"  "CF83E1357EEFB8BDF1542850D66D8007D620E4050B5715DC83F4A921D36CE9CE47D0D13C5D85F2B0FF8318D2877EEC2F63B931BD47417A81A538327AF927DA3E"
38 else
39   echo "Hash algorithm SHA-512 is not installed (not an error)"
40 fi
41
42 [ "$failed" != "" ] && error "$failed failed for empty string"
43
44 echo_n "abcdefghijklmnopqrstuvwxyz" | $GPG --with-colons --print-mds >y
45 test_one ":1:"    "C3FCD3D76192E4007DFB496CCA67E13B"
46 test_one ":2:"    "32D10C7B8CF96570CA04CE37F2A19D84240D3A89"
47 test_one ":3:"    "F71C27109C692C1B56BBDCEB5B9D2865B3708DBC"
48 if have_hash_algo "SHA256"; then
49   test_one ":8:"    "71C480DF93D6AE2F1EFAD1447C66C9525E316218CF51FC8D9ED832F2DAF18B73"
50 fi
51 if have_hash_algo "SHA384"; then
52   test_one ":9:"  "FEB67349DF3DB6F5924815D6C3DC133F091809213731FE5C7B5F4999E463479FF2877F5F2936FA63BB43784B12F3EBB4"
53 fi
54 if have_hash_algo "SHA512"; then
55   test_one ":10:" "4DBFF86CC2CA1BAE1E16468A05CB9881C97F1753BCE3619034898FAA1AABE429955A1BF8EC483D7421FE3C1646613A59ED5441FB0F321389F77F48A879C7B1F1"
56 fi
57
58 [ "$failed" != "" ] && error "$failed failed for a..z"
59
60 exit 0