[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdesupport/qca/examples/hashtest
From: Brad Hards <bradh () frogmouth ! net>
Date: 2005-02-28 5:19:27
Message-ID: 20050228051927.D28A6148A2 () office ! kde ! org
[Download RAW message or body]
CVS commit by bhards:
Update Hash example to Qt4
M +6 -6 hashtest.cpp 1.7
--- kdesupport/qca/examples/hashtest/hashtest.cpp #1.6:1.7
@@ -33,5 +33,5 @@ int main(int argc, char **argv)
// we use the first argument if provided, or
// use "hello" if no arguments
- QCString cs = (argc >= 2) ? argv[1] : "hello";
+ QSecureArray arg = (argc >= 2) ? argv[1] : "hello";
// must always check that an algorithm is supported before using it
@@ -40,6 +40,6 @@ int main(int argc, char **argv)
else {
// this shows the "all in one" approach
- QString result = QCA::SHA1().hashToString(cs);
- printf("sha1(\"%s\") = [%s]\n", cs.data(), result.latin1());
+ QString result = QCA::SHA1().hashToString(arg);
+ printf("sha1(\"%s\") = [%s]\n", arg.data(), result.toAscii().data());
}
@@ -51,6 +51,6 @@ int main(int argc, char **argv)
// for this simple job, we could use the "all in one"
// approach - this is an example, after all :-)
- QSecureArray part1(cs.left(3)); // three chars - "hel"
- QSecureArray part2(cs.mid(3)); // the rest - "lo"
+ QSecureArray part1(arg.toByteArray().left(3)); // three chars - "hel"
+ QSecureArray part2(arg.toByteArray().mid(3)); // the rest - "lo"
// create the required object.
@@ -63,5 +63,5 @@ int main(int argc, char **argv)
// convert the result into printable hexadecimal.
QString result = QCA::arrayToHex(resultArray);
- printf("md5(\"%s\") = [%s]\n", cs.data(), result.latin1());
+ printf("md5(\"%s\") = [%s]\n", arg.data(), result.toAscii().data());
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic