On Tue, 24 Apr 2018, Guionardo Furlan wrote:

Hello guys

I´ve a single code to encrypt/decrypt strings using Blowfish.

function TBlowFishCripto.Encrypt(const Value: string): string;
var
 en: TBlowFishEncryptStream;
 stream: TStringStream;
begin

  { 4 }
 s2 := TStringStream.Create(encrypted);
 { 5 }
 de := TBlowFishDeCryptStream.Create(FKey, s2);
 { 6 }
 decr := de.ReadAnsiString;

You can only read an ansistring that was written with WriteAnsistring.
This is not the case here. You must either use WriteAnstring when writing,
or read the max available bytes yourself.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to