http://www.freepascal.org/docs-html/fcl/base64/index.html 和TBase64DecodingStream
。
http://fpc-docs.gorilla3d.com/built-in-units/base64/tbase64encodingstream”
program demo;
uses Classes, base64;
var
DecodedStream: TStringStream;
EncodedStream: TStringStream;
Encoder: TBase64EncodingStream;
Output: string;
begin
DecodedStream := TStringStream.Create( Hello World! );
EncodedStream := TStringStream.Create( );
Encoder := TBase64EncodingStream.Create(EncodedStream);
Encoder.CopyFrom(DecodedStream, DecodedStream.Size);
Output := EncodedStream.DataString;
{ Outputs SGVsbG8gV29ybGQh }
WriteLn(Output);
DecodedStream.Free;
EncodedStream.Free;
Encoder.Free;
end.
http://fpc-docs.gorilla3d.com/built-in-units/base64/tbase64decodingstream”
program demo;
uses Classes, base64;
var
DecodedStream: TStringStream;
EncodedStream: TStringStream;
Decoder: TBase64DecodingStream;
Output: string;
begin
EncodedStream := TStringStream.Create( SGVsbG8gV29ybGQh );
DecodedStream := TStringStream.Create( );
Decoder := TBase64DecodingStream.Create(EncodedStream);
DecodedStream.CopyFrom(Decoder, Decoder.Size);
Output := DecodedStream.DataString;
{ Outputs Hello World! }
WriteLn(Output);
DecodedStream.Free;
EncodedStream.Free;
Decoder.Free;
end.
http://www.free Pascal.org/docs-html/fcl/ Base 64en.2/string Base64.html
Uses Base64;
var
s : AnsiString;
Begin
s:=EncodeStringBase64( Hello world! );
Writeln( Encoded : ,s);
s:=DecodeStringBase64(s);
Writeln( Decoded again : ,s);
end.