---
name: "kcapi_md_digest"
section: "3"
platform: "linux"
package: "libkcapi-dev"
version: "1.4.0-1+b2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/kcapi_md_digest"
---

# kcapi\_md\_digest(3)

calculate message digest on buffer (one-shot)

## NAME

kcapi\_md\_digest - calculate message digest on buffer (one-shot)

## SYNOPSIS

**ssize\_t kcapi\_md\_digest(struct kcapi\_handle \*** *handle***, const uint8\_t \*** *in***, size\_t** *inlen***, uint8\_t \*** *out***, size\_t** *outlen***);**

## ARGUMENTS

*handle*

\[in\] cipher handle

*in*

\[in\] buffer with input data

*inlen*

\[in\] length of input buffer

*out*

\[out\] buffer for message digest

*outlen*

\[in\] length of out

## DESCRIPTION

With this one-shot function, a message digest of the given buffer is generated. The output buffer must be allocated by the caller and have at least the length of the message digest size for the chosen message digest.

The message digest handle must have been initialized, potentially by also setting the key using the generic message digest API functions.

The input buffer can be at most INT\_MAX in size.

*return* size of message digest upon success; -EIO - data cannot be obtained; -ENOMEM - buffer is too small for the complete message digest, the buffer is filled with the truncated message digest

## AUTHOR

**Stephan Mueller** \<smueller@chronox.de\>

Author.

## COPYRIGHT
