CrackMe® Practices for Newbies
PROJECT 6: caveman by Ghiribizzo

Re: snakebyte's thread
Saturday, 27-Feb-99 13:47:56

    #include < io.h>
    #include < stdio.h>
    #include < stdlib.h>
    #include < conio.h>
    #include < string.h>

    main()
    {
    FILE *fp;
    size_t length;
    long offset;
    int len;
    // char buf[80];
    char *x="$";
    int i,y;
    unsigned long a;

    char *buf;



    if ( (fp = fopen("test.txt", "wb") )==NULL)
    {
    fprintf(stderr,"error opening file");
    exit(1);
    }

    puts("enter your name: ");
    gets(buf);



    length=strlen(buf);
    len=length+1;




    fwrite(&len,sizeof(int),1,fp);

    fseek(fp, 2, 0);

    fwrite(buf, sizeof(length),length, fp);

    fseek(fp,len+1,0);

    fwrite(x,sizeof(char),1,fp);




    if ( (fp = fopen("test.txt", "rb") )==NULL)
    {
    fprintf(stderr,"error opening file");
    exit(1);
    }




    fread(buf, sizeof(length),length, fp);
    printf("length of username is: %d , %d with terminating $\n",length,length+1);


    for(y=0;y< (length+1);y++)

    {
    a=((buf[y])< < 1)+((buf[y])>>31);

    printf("%ld",a);

    }
    printf("\n...after checksum algorithm");


    return 0;

    }

    any idea how I can translate the instruction in line :016d add ah,al into a C instruction?
    the algorithm above seems to be working, but is not producing correct output...the only thing
    I can see missing is the add ah,al instruction executed after each :016c lodsb...

    I hope this thread is appropriate for this forum...I think the knowledge of how and why involved is widespread enough to merit posting...
    it's hard to find any help on these types of topics and all help is appreciated...while I understand Andy's point about the four binary zero's, I would like to more fully understand overall checksum algorithms for other situations...

    snakebyte__

    *** note ***

    this was compiled with borland 3.1 in a DOS shell



Message thread:

snakebyte's thread (snakebyte__@hotmail.com) (20-Feb-99 09:08:43)

Back to main board