2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
17 int main(int argc, char *argv[])
19 printf("No MD5 support\n");
23 # include <openssl/evp.h>
24 # include <openssl/md5.h>
26 static char *test[] = {
31 "abcdefghijklmnopqrstuvwxyz",
32 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
33 "12345678901234567890123456789012345678901234567890123456789012345678901234567890",
37 static char *ret[] = {
38 "d41d8cd98f00b204e9800998ecf8427e",
39 "0cc175b9c0f1b6a831c399e269772661",
40 "900150983cd24fb0d6963f7d28e17f72",
41 "f96b697d7cb7938d525a2f31aaf161d0",
42 "c3fcd3d76192e4007dfb496cca67e13b",
43 "d174ab98d277d9f5a5611c2c9f419d9f",
44 "57edf4a22be3c955ac49da2e2107b67a",
47 static char *pt(unsigned char *md);
48 int main(int argc, char *argv[])
53 unsigned char md[MD5_DIGEST_LENGTH];
59 EVP_Digest(&(P[0][0]), strlen((char *)*P), md, NULL, EVP_md5(), NULL);
61 if (strcmp(p, (char *)*R) != 0) {
62 printf("error calculating MD5 on '%s'\n", *P);
63 printf("got %s instead of %s\n", p, *R);
66 printf("test %d ok\n", i);
75 static char *pt(unsigned char *md)
80 for (i = 0; i < MD5_DIGEST_LENGTH; i++)
81 sprintf(&(buf[i * 2]), "%02x", md[i]);