Example of cryptographic digest code.
Example of cryptographic digest code.
#ifndef DEBUG
#define DEBUG
#endif
#include <ucommon-config.h>
#include <stdio.h>
int main(int argc, char **argv)
{
md5.
puts(
"this is some text");
assert(eq("684d9d89b9de8178dcd80b7b4d018103", *md5));
md5 = "sha";
md5.puts("something else");
assert(!eq("684d9d89b9de8178dcd80b7b4d018103", *md5));
md5 = "md5";
md5.puts("this is some text");
assert(eq("684d9d89b9de8178dcd80b7b4d018103", *md5));
secure::keybytes key = md5.
key();
assert(eq(
"684d9d89b9de8178dcd80b7b4d018103", key.
hex()));
secure::string dig = Digest::md5("this is some text");
assert(eq("684d9d89b9de8178dcd80b7b4d018103", *dig));
return 0;
}
This library holds basic cryptographic functions and secure socket support for use with GNU uCommon C...
Common namespace for all ucommon objects.
A cryptographic digest class.