[fpc-pascal] Saving and reading TBlowfish crypted text
Ewald
ewald at yellowcouch.org
Tue Mar 17 19:49:26 CET 2015
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
More information about the fpc-pascal
mailing list