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
16 #ifdef OPENSSL_NO_RMD160
17 int main(int argc, char *argv[])
19 printf("No ripemd support\n");
23 # include <openssl/ripemd.h>
24 # include <openssl/evp.h>
26 # ifdef CHARSET_EBCDIC
27 # include <openssl/ebcdic.h>
30 static char test[][100] = {
35 { "abcdefghijklmnopqrstuvwxyz" },
36 { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" },
37 { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" },
38 { "12345678901234567890123456789012345678901234567890123456789012345678901234567890" }
41 static char *ret[] = {
42 "9c1185a5c5e9fc54612808977ee8f548b2258d31",
43 "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe",
44 "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc",
45 "5d0689ef49d2fae572b881b123a85ffa21595f36",
46 "f71c27109c692c1b56bbdceb5b9d2865b3708dbc",
47 "12a053384a9c0c88e405a06c27dcf49ada62eb2b",
48 "b0e20b6e3116640286ed3a87a5713079b21f5189",
49 "9b752e45573d4b39f4dbd3323cab82bf63326bfb",
52 static char *pt(unsigned char *md);
53 int main(int argc, char *argv[])
59 unsigned char md[RIPEMD160_DIGEST_LENGTH];
62 for (i = 0; i < OSSL_NELEM(test); i++) {
63 # ifdef CHARSET_EBCDIC
64 ebcdic2ascii(test[i], test[i], strlen(test[i]));
66 if (!EVP_Digest(test[i], strlen(test[i]), md, NULL, EVP_ripemd160(),
68 printf("EVP Digest error.\n");
72 if (strcmp(p, (char *)*R) != 0) {
73 printf("error calculating RIPEMD160 on '%s'\n", test[i]);
74 printf("got %s instead of %s\n", p, *R);
77 printf("test %d ok\n", i + 1);
83 static char *pt(unsigned char *md)
88 for (i = 0; i < RIPEMD160_DIGEST_LENGTH; i++)
89 sprintf(&(buf[i * 2]), "%02x", md[i]);