char
strings require an extra char for the NUL terminating
character, so add one more to the size a VB programmer would use
(see C/C++ users must add one to this value)
For example
char sDigest_sha1[41]; /* SHA-1 digest is 40 hex chars plus NUL */ char sDigest_sha2[65]; /* SHA-256 digest is 64 hex chars plus NUL */
or
#include <stdlib.h> char *buf; buf = malloc(API_MAX_HASH_CHARS + 1); /* ... */ free(buf);
We recommend using the defined constants like API_SHA1_CHARS
and API_SHA1_BYTES
rather than hard-coded numbers, e.g.
char sDigest_sha1[API_SHA1_CHARS + 1];
See the constants in diCryptoSys.h
.
For examples, see the test code TestAPI.c.c
and APICheck.c
provided in the distribution.