anybody have any experience with this?

i'm currently using Jim Conger's C++ implementation and i just can't quite get it to work right.

i'm currently reading a file, encrypting it and writing the encrypted data to a new file. reading the encrypted file, then decrypting it ad writing that to a third file.

for an original input of:

1234 4321 abcd dcba
1234 4321 abcd dcba
1234 4321 abcd dcba
1234 4321 abcd dcba
abcdefghijklmnopqrstuvwxyz
0123456789
the quick brown fox jumps over the lazy dog

i get:

1234 4321 abcd dcba
1234 4321 abcd dcba
1234 4321 abcd dcba
1234 4321 abcd dcba
abcdefghijklmnopqrstuvwxyz
0123456789
the quick brown f>b8Ç'3~²]'uêÍN¦tZQµ{‡š^9žú


this implementation supposedly has padding to accomodate input blocks that aren't exactly 64bits, but it doesn't quite seem to be doing the job right.

trying to pad them myself horks the entire decryption process

i'm also finding some garbage at the end of the file for some reason. a bunch of odd characters that are clearly NOT in the text file. these seem to be part of the problem, but i have no idea what they are or why there are there.

here's the quick and dirty code i'm using to verify integrity between encryption & decryption...

Code:
CBlowFish *bf = new CBlowFish();
        char *key ="thisisthekey";
        bf->Initialize(key,StrLen(key));
        String input;

        FILE *file = fopen("C:\\test.txt","r");
        FILE *outfile = fopen("C:\\Enctest.txt","w");
        String output;
        int n = 8;
        int size = 1;
        if(file !=NULL&& outfile !=NULL)
        {
                fseek(file,0,0);
                int result = fread(input.c_str(),size,n,file);
                while(result ==n)
                {
                        bf->Encode(input.c_str(),output.c_str(),StrLen(inp ut.c_str()));
                        fwrite(output.c_str(),sizeof(output[0]),StrLen(out put.c_str()),outfile);
                        input = "";
                        result = fread(input.c_str(),size,n,file);
                }
                if(result>0)
                {
                        input = input.c_str();
                        input = input.SubString(0,result);               
                        for(int i=0;i<n-result;i++)
                        {
                                input = input+NULL;
                                bf->Encode(input.c_str(),output.c_str(),StrLen(inp ut.c_str()));
                                fwrite(output.c_str(),sizeof(output[0]),StrLen(out put.c_str()),outfile);
                        }
                }
        }
        fclose(outfile);
        fclose(file);
        file = fopen("C:\\Enctest.txt","r");
        outfile = fopen("C:\\Denctest.txt","w");
        if(file !=NULL&& outfile !=NULL)
        {
                fseek(file,0,0);
                int result = fread(input.c_str(),size,n,file);
                while(result > 0)
                {
                        bf->Decode(input.c_str(),output.c_str(),StrLen(inp ut.c_str()));
                        fwrite(output.c_str(),sizeof(output[0]),StrLen(out put.c_str()),outfile);
                        input = "";                       
                        result = fread(input.c_str(),size,n,file);
                }
        }
        fclose(outfile);
        fclose(file);

halp!