Must be a bug in whatever version of the compiler you are using.
Linux 32 (Ubuntu 16.04) / Free Pascal Compiler version 3.3.1-r20:41871M [2019/04/15] for i386 and Free Pascal Compiler version 3.0.4 [2017/10/02] for i386
Linux 64 (UBUNTU 19.04) / Free Pascal Compiler version 3.2.0-beta-r44874 [2020/04/19] for x86_64
I get the expected result of tNpbgC8ZQDOcSkHAWopKzQjJ1hI= everytime
Hello, I wanted to consult you. If you know why this can happen.
The same functions in 64bits return different result in Linux 32bits, than in 64bits. Also try on windows32 and macos64, they return the same value as linux64.
But linux32 returns different values.
The result must be: tNpbgC8ZQDOcSkHAWopKzQjJ1hI=
But in linux32 is not (the value return is: AoVU8zR2n+1MVbedLj2kKV4v5aQ=).
UPDATE: The result in Linux32, changes in every run %)
Thanks!!!
$ cat sha1test.pas
uses
sha1;
begin
WriteLn(SHA1Print(SHA1String('test258EAFA5-E914-47DA-95CA-C5AB0DC85B11')));
end.
$ fpc -l -Pi386 sha1test.pas && ./sha1test
Hint: End of reading config file /etc/fpc.cfg
Free Pascal Compiler version 3.3.1 [2020/04/22] for i386
Copyright (c) 1993-2020 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling sha1test.pas
Linking sha1test
6 lines compiled, 0.1 sec
1 hint(s) issued
de654445af78fa61244e4a1a1c56c5111be90378
$ fpc -l -Px86_64 sha1test.pas && ./sha1test
Hint: End of reading config file /etc/fpc.cfg
Free Pascal Compiler version 3.3.1 [2020/04/22] for x86_64
Copyright (c) 1993-2020 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling sha1test.pas
Linking sha1test
6 lines compiled, 0.1 sec
1 hint(s) issued
b4da5b802f1940339c4a41c05a8a4acd08c9d612
I tried {$DEFINE SHA1PASCAL} with no luckUseless if you define it for your project. You must recompile sha1 unit with this define instead, but I've tried this and the result was identical.