<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=us-ascii" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi<br>
<br>
Worked out the problem !<br>
<br>
I was using a Tstringlist for loading and saving to files in some
places.&nbsp; Replacing this with TFileStream fixed the issues.&nbsp; My Mime64
encoded and decoded file has the same CRC as the original.&nbsp; Feels good
:)<br>
<br>
Thanks for the suggestions anyway !<br>
<br>
ta<br>
Rob<br>
<br>
<div class="moz-signature">
<meta http-equiv="Content-Type" content="text/html; ">
<meta name="ProgId" content="Word.Document">
<meta name="Generator" content="Microsoft Word 11">
<meta name="Originator" content="Microsoft Word 11">
<link rel="File-List" href="Robert%20Martin_files/filelist.xml">
<title>Robert Martin</title>
<!--[if gte mso 9]><xml>
 <o:DocumentProperties>
  <o:Author>Wild Software Ltd</o:Author>
  <o:LastAuthor>Wild Software Ltd</o:LastAuthor>
  <o:Revision>6</o:Revision>
  <o:TotalTime>55</o:TotalTime>
  <o:Created>2009-02-13T02:47:00Z</o:Created>
  <o:LastSaved>2009-02-13T03:42:00Z</o:LastSaved>
  <o:Pages>1</o:Pages>
  <o:Words>13</o:Words>
  <o:Characters>77</o:Characters>
  <o:Company>Wild Software Ltd</o:Company>
  <o:Lines>1</o:Lines>
  <o:Paragraphs>1</o:Paragraphs>
  <o:CharactersWithSpaces>89</o:CharactersWithSpaces>
  <o:Version>11.9999</o:Version>
 </o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:PunctuationKerning/>
  <w:ValidateAgainstSchemas/>
  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
  <w:Compatibility>
   <w:Break
WrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
   <w:DontGrowAutofit/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
 </w:LatentStyles>
</xml><![endif]-->
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-parent:"";
        margin:0cm;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";}
span.SpellE
        {mso-style-name:"";
        mso-spl-e:yes;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;
        mso-header-margin:35.4pt;
        mso-footer-margin:35.4pt;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style><!--[if gte mso 10]>
<style>
 /* Style Definitions */
 table.MsoNormalTable
        {mso-style-name:"Table Normal";
        mso-tstyle-rowband-size:0;
        mso-tstyle-colband-size:0;
        mso-style-noshow:yes;
        mso-style-parent:"";
        mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
        mso-para-margin:0cm;
        mso-para-margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.0pt;
        font-family:"Times New Roman";
        mso-ansi-language:#0400;
        mso-fareast-language:#0400;
        mso-bidi-language:#0400;}
</style>
<![endif]-->
<div class="Section1">
<p class="MsoNormal"><span style="" lang="EN-NZ"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(255, 153, 0);" lang="EN-NZ"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="" lang="EN-NZ"><o:p>&nbsp;</o:p></span></p>
</div>
</div>
<br>
<br>
Robert martin wrote:
<blockquote cite="mid:4A934D75.90801@chreos.co.nz" type="cite">
  <pre wrap="">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: <a class="moz-txt-link-abbreviated" href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</a>
Admin: <a class="moz-txt-link-freetext" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a>
Unsubscribe: send an email to <a class="moz-txt-link-abbreviated" href="mailto:delphi-request@delphi.org.nz">delphi-request@delphi.org.nz</a> with Subject: unsubscribe

  </pre>
</blockquote>
</body>
</html>