On 17 Mar 2015, at 10:50, Graeme Geldenhuys wrote: > On 2015-03-16 20:05, Antonio Sanguigni wrote: >> en.WriteAnsiString(Memo1.Lines.Text); >> fs.WriteBuffer(Pointer(s1.DataString)^, length(s1.DataString)); >> en.Free; > > Maybe you decryption isn't working because the encrypted text you > created isn't complete. > > Normally you need to call Flush to write the remaining bytes before you > free the TBlowFishEncryptStream instance.
The docs state that it is called automatically upon destruction: "Flush is called automatically when the stream is destroyed, so there is no need to call it after all data was written and the stream is no longer needed." -- http://www.freepascal.org/docs-html/fcl/blowfish/tblowfishencryptstream.flush.html A question related to this thread: what mode-of-operation do the TBlowFishStream descendants use? e.g. EBC, CBC, STR, OFB, ... (abbreviations taken from http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation) It is not documented at http://www.freepascal.org/docs-html/fcl/blowfish/tblowfishencryptstream.html I think. -- Ewald _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal