diff options
| author | Darrell Anderson <humanreadable@yahoo.com> | 2012-04-17 19:51:44 -0500 |
|---|---|---|
| committer | Darrell Anderson <humanreadable@yahoo.com> | 2012-04-17 19:51:44 -0500 |
| commit | c663e43e7172bb80a8fb779e4dc74f579a60ec45 (patch) | |
| tree | fd72db9c80e6c1aacf67e8bd24f75a4da57c4a2e /examples/hashtest/hashtest.cpp | |
| download | tqca-c663e43e7172bb80a8fb779e4dc74f579a60ec45.tar.gz tqca-c663e43e7172bb80a8fb779e4dc74f579a60ec45.zip | |
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.
Diffstat (limited to 'examples/hashtest/hashtest.cpp')
| -rw-r--r-- | examples/hashtest/hashtest.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
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<stdio.h> + +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; +} + |
