Sortix cross-nightly manual
This manual documents Sortix cross-nightly. You can instead view this document in the latest official manual.
NAME
EVP_MD_CTX_new, EVP_MD_CTX_reset, EVP_MD_CTX_free, EVP_MD_CTX_init, EVP_MD_CTX_create, EVP_MD_CTX_cleanup, EVP_MD_CTX_destroy, EVP_DigestInit_ex, EVP_DigestUpdate, EVP_DigestFinal_ex, EVP_Digest, EVP_MD_CTX_copy_ex, EVP_DigestInit, EVP_DigestFinal, EVP_MD_CTX_copy, EVP_MD_CTX_md, EVP_md_null, EVP_sha224, EVP_sha256, EVP_sha384, EVP_sha512, EVP_sha512_224, EVP_sha512_256, EVP_ripemd160, EVP_get_digestbyname, EVP_get_digestbynid, EVP_get_digestbyobj — EVP digest routinesSYNOPSIS
#include <openssl/evp.h>EVP_MD_CTX_new(void);
EVP_MD_CTX_reset(EVP_MD_CTX *ctx);
EVP_MD_CTX_free(EVP_MD_CTX *ctx);
EVP_MD_CTX_init(EVP_MD_CTX *ctx);
EVP_MD_CTX_create(void);
EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx);
EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);
EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt);
EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);
EVP_Digest(const void *d, size_t cnt, unsigned char *md, unsigned int *s, const EVP_MD *type, ENGINE *impl);
EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in);
EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);
EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);
EVP_MD_CTX_copy(EVP_MD_CTX *out, EVP_MD_CTX *in);
EVP_MD_CTX_md(const EVP_MD_CTX *ctx);
EVP_md_null(void);
EVP_sha224(void);
EVP_sha256(void);
EVP_sha384(void);
EVP_sha512(void);
EVP_sha512_224(void);
EVP_sha512_256(void);
EVP_ripemd160(void);
EVP_get_digestbyname(const char *name);
EVP_get_digestbynid(int type);
EVP_get_digestbyobj(const ASN1_OBJECT *o);
DESCRIPTION
The EVP digest routines are a high-level interface to message digests and should be used instead of the cipher-specific functions.RETURN VALUES
EVP_MD_CTX_new() and EVP_MD_CTX_create() return the new EVP_MD_CTX object or NULL for failure.EXAMPLES
This example digests the data "Test Message\n" and "Hello World\n", using the digest name passed on the command line.#include <stdio.h> #include <string.h> #include <openssl/evp.h> int main(int argc, char *argv[]) { EVP_MD_CTX *mdctx; const EVP_MD *md; const char mess1[] = "Test Message\n"; const char mess2[] = "Hello World\n"; unsigned char md_value[EVP_MAX_MD_SIZE]; unsigned int md_len, i; if (argc <= 1) { printf("Usage: mdtest digestname\n"); exit(1); } md = EVP_get_digestbyname(argv[1]); if (md == NULL) { printf("Unknown message digest %s\n", argv[1]); exit(1); } mdctx = EVP_MD_CTX_new(); EVP_DigestInit_ex(mdctx, md, NULL); EVP_DigestUpdate(mdctx, mess1, strlen(mess1)); EVP_DigestUpdate(mdctx, mess2, strlen(mess2)); EVP_DigestFinal_ex(mdctx, md_value, &md_len); EVP_MD_CTX_free(mdctx); printf("Digest is: "); for(i = 0; i < md_len; i++) printf("%02x", md_value[i]); printf("\n"); return 0; }