qcrypto_memcmp()

Updated: October 26, 2022

Fixed-time memory comparison

Synopsis:

#include <qcrypto/qcrypto.h>
int qcrypto_memcmp(const uint8_t *v1,
                   const uint8_t *v2,
                   size_t size)

Arguments:

v1
The first value.
v2
The second value.
size
The number of bytes to compare.

Library:

libqcrypto

Description:

To resist timing attacks, this function compares the inputs in fixed time relative to the size.

Returns:

A value of 1 if the values are equal, 0 otherwise.