delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / runtime / kwalletd / backend / tests / testsha.cpp
blobce3501b66e6a1e650e8f3061cc2089f78077a305
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include "sha1.h"
7 int main() {
8 SHA1 *sha1;
9 unsigned char data[] = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
10 unsigned long et[] = {0x11223344};
11 int rc;
13 printf("%d: 0x11 == %d and 0x44 == %d\n", ((unsigned char *)et)[0],
14 0x11, 0x44);
15 sha1 = new SHA1();
17 if (!sha1->readyToGo()) {
18 printf("Error: not ready to go!\n");
19 return -1;
22 printf("About to process [%s]\n", data);
23 rc = sha1->process(data, strlen((char *)data));
25 if (rc != strlen((char *)data)) {
26 printf("Error processing the data. rc=%d\n", rc);
27 } else printf("Done.\n");
29 const unsigned char *res = sha1->hash();
31 if (res) {
32 for (int i = 0; i < 20; i++) {
33 printf("%.2X", *res++);
34 if (i>0 && (i-1)%2 == 0) printf(" ");
36 printf("\n");
37 } else printf("Error - getHash() returned NULL!\n");
39 delete sha1;