3
0
mirror of https://github.com/Qortal/Brooklyn.git synced 2025-01-31 15:22:18 +00:00
Brooklyn/tools/build/feature/test-libcrypto.c

26 lines
537 B
C
Raw Normal View History

2022-04-02 13:24:21 +00:00
// SPDX-License-Identifier: GPL-2.0
2022-09-09 09:21:57 +00:00
#include <openssl/evp.h>
2022-04-02 13:24:21 +00:00
#include <openssl/sha.h>
#include <openssl/md5.h>
int main(void)
{
2022-09-09 09:21:57 +00:00
EVP_MD_CTX *mdctx;
2022-04-02 13:24:21 +00:00
unsigned char md[MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH];
unsigned char dat[] = "12345";
2022-09-09 09:21:57 +00:00
unsigned int digest_len;
2022-04-02 13:24:21 +00:00
2022-09-09 09:21:57 +00:00
mdctx = EVP_MD_CTX_new();
if (!mdctx)
return 0;
EVP_DigestInit_ex(mdctx, EVP_md5(), NULL);
EVP_DigestUpdate(mdctx, &dat[0], sizeof(dat));
EVP_DigestFinal_ex(mdctx, &md[0], &digest_len);
EVP_MD_CTX_free(mdctx);
2022-04-02 13:24:21 +00:00
SHA1(&dat[0], sizeof(dat), &md[0]);
return 0;
}