1
/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
22
#include "apr_xlate.h"
23
#include "apr_general.h"
34
"\xa5\x25\x8a\x89\x11\xb2\x9d\x1f\x81\x75\x96\x3b\x60\x94\x49\xc0"},
35
{"01234567890aBcDeFASDFGHJKLPOIUYTR"
36
"POIUYTREWQZXCVBN LLLLLLLLLLLLLLL",
37
"\xd4\x1a\x06\x2c\xc5\xfd\x6f\x24\x67\x68\x56\x7c\x40\x8a\xd5\x69"},
38
{"111111118888888888888888*******%%%%%%%%%%#####"
39
"142134u8097289720432098409289nkjlfkjlmn,m.. ",
40
"\xb6\xea\x5b\xe8\xca\x45\x8a\x33\xf0\xf1\x84\x6f\xf9\x65\xa8\xe1"},
41
{"01234567890aBcDeFASDFGHJKLPOIUYTR"
42
"POIUYTREWQZXCVBN LLLLLLLLLLLLLLL"
43
"01234567890aBcDeFASDFGHJKLPOIUYTR"
44
"POIUYTREWQZXCVBN LLLLLLLLLLLLLLL"
46
"\xd1\xa1\xc0\x97\x8a\x60\xbb\xfb\x2a\x25\x46\x9d\xa5\xae\xd0\xb0"}
49
static int num_sums = sizeof(md5sums) / sizeof(md5sums[0]);
52
static void test_md5sum(abts_case *tc, void *data)
54
apr_md5_ctx_t context;
55
unsigned char digest[APR_MD5_DIGESTSIZE];
56
const void *string = md5sums[count].string;
57
const void *sum = md5sums[count].digest;
58
unsigned int len = strlen(string);
60
ABTS_ASSERT(tc, "apr_md5_init", (apr_md5_init(&context) == 0));
61
ABTS_ASSERT(tc, "apr_md5_update",
62
(apr_md5_update(&context, string, len) == 0));
63
ABTS_ASSERT(tc, "apr_md5_final", (apr_md5_final(digest, &context)
65
ABTS_ASSERT(tc, "check for correct md5 digest",
66
(memcmp(digest, sum, APR_MD5_DIGESTSIZE) == 0));
69
abts_suite *testmd5(abts_suite *suite)
71
suite = ADD_SUITE(suite);
73
for (count=0; count < num_sums; count++) {
74
abts_run_test(suite, test_md5sum, NULL);