nqdcommit(3)
NAME
nqdcommit,
nqdreveal, nqdcite —
commitments and citations of a data record
LIBRARY
libnqd, -lnqd -lnoqtis
SYNOPSIS
#include
<nqd.h>
int
nqdcommit(const uint8_t *salt,
size_t sl, const uint8_t *m,
size_t n, char hex[65]);
int
nqdreveal(const nqdrec *r,
const uint8_t *salt, size_t sl,
const uint8_t *m, size_t n,
size_t *idx);
int
nqdcite(const nqdrec *r,
int fmt, char *out,
size_t cap, size_t *outlen);
DESCRIPTION
nqdcommit()
writes to hex the 64 lower-case hex digits (and a NUL)
of the commitment to the n bytes at
m under the secret salt of
sl bytes, 16 to 1,024 (take 32 from
nqrand(3)): SHA3-256 of
the string ‘noqtis-commit-1’ with its
NUL, the salt's length as 8 bytes big-endian, the salt and the bytes. The
tag keeps the digest from passing for any other digest noqtis makes; the
length fixes where the salt ends. Put it in a
‘commits’ element with
nqdput(3).
nqdreveal()
computes the same over m and
salt and compares it with every
‘commits’ digest of
r, each in constant time; on a match
*idx (when not NULL) gets the
element's index.
nqdcite()
writes the record's ‘cite’ as a
CITATION.cff 1.2.0 (NQDCFF)
or a BibTeX entry (NQDBIB) to
out, as
nqdjson(3) writes.
RETURN VALUES
NQOK; nqdreveal():
NQEVRFY when no commitment matches;
nqdcite(): NQEIO when there
is no ‘cite’,
NQEBUF for a cap too small;
NQEARG for a salt out of bounds or an unknown
format.
SEE ALSO
noqtis-cite(1), noqtis-commit(1), noqtis-reveal(1), nqdnew(3), noqtis-data(5)