]>
git.ipfire.org Git - thirdparty/openssl.git/blob - test/md2test.c
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 MD2 support\n");
23 # include <openssl/evp.h>
24 # include <openssl/md2.h>
26 # ifdef CHARSET_EBCDIC
27 # include <openssl/ebcdic.h>
30 static char *test
[] = {
35 "abcdefghijklmnopqrstuvwxyz",
36 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
37 "12345678901234567890123456789012345678901234567890123456789012345678901234567890",
41 static char *ret
[] = {
42 "8350e5a3e24c153df2275c9f80692773",
43 "32ec01ec4a6dac72c0ab96fb34c0b5d1",
44 "da853b0d3f88d99b30283a69e6ded6bb",
45 "ab4f496bfb2a530b219ff33031fe06b0",
46 "4e8ddff3650292ab5a4108c3aa47940b",
47 "da33def2a42df13975352846c30338cd",
48 "d5976f79d83d3a0dc9806c3c66f3efd8",
51 static char *pt(unsigned char *md
);
52 int main(int argc
, char *argv
[])
57 unsigned char md
[MD2_DIGEST_LENGTH
];
63 if (!EVP_Digest((unsigned char *)*P
, strlen(*P
), md
, NULL
, EVP_md2(),
65 printf("EVP Digest error.\n");
69 if (strcmp(p
, *R
) != 0) {
70 printf("error calculating MD2 on '%s'\n", *P
);
71 printf("got %s instead of %s\n", p
, *R
);
74 printf("test %d ok\n", i
);
83 static char *pt(unsigned char *md
)
88 for (i
= 0; i
< MD2_DIGEST_LENGTH
; i
++)
89 sprintf(&(buf
[i
* 2]), "%02x", md
[i
]);