On 9 December 2011 10:02, Vincent Snijders wrote: > > I have one question about this code, why is RandSeed set inside the > loop and not outside the loop or even at the program start?
For the full code as used by tiOPF, see the following URL. http://tiopf.svn.sourceforge.net/viewvc/tiopf/tiOPF2/Trunk/Options/tiEncryptSimple.pas?revision=2143&view=markup I didn't write this encryption code, I merely debugged why the unit tests for this unit took so long to complete, compared to under Delphi. Looking at the code again, I have no idea how it will affect the encryption algorithm if I move the assignment to RandSeed outside the loop (just after the first assignment to ByteValue). As a test, made your suggested change and ran the unit tests. The unit tests still pass, and the performance under FPC has drastically improved. FPC (64-bit) is now roughly 4 times slower that Delphi. Much better indeed, and an acceptable result. I'll see if I can get hold of the original author of this code and what they think about the suggested change - and if it will affect the encryption algorithm at all. Thanks Vincent for mentioning this. I totally overlooked that. -- Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal