Example of cipher code.
#ifndef DEBUG
#define DEBUG
#endif
#include <ucommon-config.h>
#include <stdio.h>
#define STR "this is a test of some text we wish to post"
int main(int argc, char **argv)
{
return 0;
skey_t mykey(
"aes256",
"sha",
"testing");
uint8_t ebuf[256], dbuf[256];
memset(dbuf, 0, sizeof(dbuf));
enc.
set(&mykey, Cipher::ENCRYPT, ebuf);
dec.set(&mykey, Cipher::DECRYPT, dbuf);
size_t total = enc.
puts(STR);
assert(!
eq(STR, (
char *)ebuf, strlen(STR)));
assert(total == 48);
assert(
eq((
char *)dbuf, STR));
return 0;
}