#include #include #include #include extern unsigned char *asma(unsigned char *s); extern unsigned char *asma_callchecking(unsigned char *s); unsigned char *orig_asma(unsigned char *s) { int i; for (i=0; i<16; i++) { unsigned char c=s[i]; c += (c>='A' && c<='Z') ? 'a'-'A' : 0; s[i] = c; } return s; } static char ascii(char s) { if(s < 0x20) return '.'; if(s > 0x7E) return '.'; return s; } static void hexdump(void *d, int len) { unsigned char *data; int i, off; data = (unsigned char*)d; for (off=0; off=len) printf(" "); else printf("%02x ",data[off+i]); printf(" "); for(i=0; i<16; i++) if((i+off)>=len) printf(" "); else printf("%c",ascii(data[off+i])); printf("\n"); } } int main2(void) { char *input1[]={"asdfABCDEFGHKL54", "foofuuMUHkk", "AbC", "BLA|MUHMKUH|KA", "XZY"}; char *output1; char *output2; char *input2; char *input3; int i, j; int off[] = {2,0,0,0,0}; for(i = 0; i < 5; i++) { input2 = strdup(input1[i]); input3 = strdup(input1[i]); output1 = (char *)orig_asma((unsigned char *)(input2 + off[i])); output2 = (char *)asma((unsigned char *)(input3 + off[i])); output1[16]='\0'; output2[16]='\0'; printf("\n"); if(memcmp(output1,output2, 16)) { j = 0; printf("Testfall falsch; Input war: \"%s\"\n", input1[i]); printf("erwartet:\n\t\"%s\"\ntatsaechliches Ergebnis:\n\t\"%s\"\n", output1, output2); } else { printf("Testfall \"%s\" passt.\n", output1); } free(input2); free(input3); } return 0; } void printchar(unsigned char c) { if (c<' ' || c>126 || c=='"') printf("\\x%02x",c); else putchar(c); } void printarray(unsigned char* bufstart, int buflength, unsigned char* s) { int i; unsigned char *p=s-16; unsigned long pl; unsigned long l=16; if (pbufstart+buflength) pl=bufstart+buflength-p; printf("%p=",p); for(i=0; ;i++) { if (p+i==s+l) printf("\""); if (!(i