From c663e43e7172bb80a8fb779e4dc74f579a60ec45 Mon Sep 17 00:00:00 2001 From: Darrell Anderson Date: Tue, 17 Apr 2012 19:51:44 -0500 Subject: Added tqca package to the sources tree. This module is from the original qca-1.0 sources with the TQt layer added. This resolves bug report 817. --- examples/hashtest/hashtest.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 examples/hashtest/hashtest.cpp (limited to 'examples/hashtest/hashtest.cpp') diff --git a/examples/hashtest/hashtest.cpp b/examples/hashtest/hashtest.cpp new file mode 100644 index 0000000..917c396 --- /dev/null +++ b/examples/hashtest/hashtest.cpp @@ -0,0 +1,25 @@ +#include"qca.h" +#include + +int main(int argc, char **argv) +{ + TQCA::init(); + TQCString cs = (argc >= 2) ? argv[1] : "hello"; + + if(!TQCA::isSupported(TQCA::CAP_SHA1)) + printf("SHA1 not supported!\n"); + else { + TQString result = TQCA::SHA1::hashToString(cs); + printf("sha1(\"%s\") = [%s]\n", cs.data(), result.latin1()); + } + + if(!TQCA::isSupported(TQCA::CAP_MD5)) + printf("MD5 not supported!\n"); + else { + TQString result = TQCA::MD5::hashToString(cs); + printf("md5(\"%s\") = [%s]\n", cs.data(), result.latin1()); + } + + return 0; +} + -- cgit v1.2.3