CnPack Forum


 
Subject: cnvcl的base64单元
npc8
灌水科科长
Rank: 3Rank: 3



UID 65881
Digest Posts 0
Credits 115
Posts 37
点点分 115
Reading Access 10
Registered 2011-5-26
Status Offline
Post at 2016-4-29 16:55  Profile | Blog | P.M. 
cnvcl的base64单元

function Base64Encode(InputData: TStream; var OutputData: string): Byte; overload;
var
  Str: TStringStream;
begin
  Str := TStringStream.Create('');
  try
    Str.CopyFrom(InputData, InputData.Size);
    Result := Base64Encode({$IFDEF UNICODE}AnsiString{$ENDIF}(Str.DataString), OutputData);
  finally
    Str.Free;
  end;
end;

InputData中间如果某些byte是$00 会影响Str.DataString,继而出现加密错误
Top
Passion (LiuXiao)
管理员
Rank: 9Rank: 9Rank: 9


UID 359
Digest Posts 19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
Post at 2016-5-3 10:05  Profile | Blog | P.M. 
我查查。
Top
Passion (LiuXiao)
管理员
Rank: 9Rank: 9Rank: 9


UID 359
Digest Posts 19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
Post at 2016-5-3 16:56  Profile | Blog | P.M. 
已修正。并增加了一个允许传入内存块指针与长度的方法进行Encode。麻烦从git上更新一下最新代码?
Top
 




All times are GMT++8, the time now is 2024-11-24 23:18

    本论坛支付平台由支付宝提供
携手打造安全诚信的交易社区 Powered by Discuz! 5.0.0  © 2001-2006 Comsenz Inc.
Processed in 0.007347 second(s), 9 queries , Gzip enabled

Clear Cookies - Contact Us - CnPack Website - Archiver - WAP