Title: Robert Martin
Hi

Worked out the problem !

I was using a Tstringlist for loading and saving to files in some places.  Replacing this with TFileStream fixed the issues.  My Mime64 encoded and decoded file has the same CRC as the original.  Feels good :)

Thanks for the suggestions anyway !

ta
Rob

 

 

 



Robert martin wrote:
Hi

I have a set of functions (not written by me) that encode and decode 
mime64 data.  I want to take a file and mime64 encrypt it than at a 
later point decrypt it.  However I am having trouble calling the 
functions and there is no help.

Functions

function Base64Encode(const InText: string): string; overload;

function Base64Decode(const InText: string): string; overload;


To do the encode I have the following function

var
    fs          : TFileStream;
    BufferIn    : AnsiString;
begin
    fs := TFileStream.Create(FileName, fmOpenRead);
    try
        fs.Position := 0;

        SetString(BufferIn, nil, fs.Size);
        fs.Read(Pointer(BufferIn)^, fs.Size);
        Result := Base64Encode(BufferIn);
    finally
        fs.Free;
    end;


I use a string list to save the output.  I thought this was working but 
when I come to decode it the system checks and finds it is an invalid 
file (does not divide evenly by 4).  Can anyone see what might be wrong 
with the above?

Cheers
Rob

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe

  
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
unsubscribe

Reply via email to