[fpc-devel] x86_64 SHA1 implementation (J. Gareth Moreton)
J. Gareth Moreton
gareth at moreton-family.com
Sun Sep 17 10:41:29 CEST 2023
I will admit that part of me likes to program my own implementations in
assembly language if just for the practice, especially learning where
latency and stalls happen. The problem with most of the examples given
in this chain is that they use a 'high-level' assembly language with
macros and variables among other things, or use the SHA-specific
opcodes. The mORMot 2 example looks good for the SHA-specific opcodes
though and I'll give that one a try. It's under a MPL/GPL/LGPL licence
so I think that's compatible for us.
Granted, at the very least, the "basic" x86_64 port of the i386 code
works fine, so we always have this one to fall back on.
On 17/09/2023 08:37, Florian Klämpfl via fpc-devel wrote:
>> Am 17.09.2023 um 08:45 schrieb Arnaud Bouchez via fpc-devel <fpc-devel at lists.freepascal.org>:
>> There is a working SHA-1 and SHA-256 implementation using x86_64 asm and also SHA-NI in mORMot 2.
>> Numbers are very high, e.g. 2GB/s on my Core i5 13500.
>> Since there is no SHA opcode in FPC asm yet (neither in Delphi), I am using hardcoded "db" arrays for SHA-NI instructions.
> Trunk should have them.
>> See https://github.com/synopse/mORMot2/blob/4c59b3c212c5efd2f440c1d7f61504ca832a5931/src/crypt/mormot.crypt.core.asmx64.inc#L1154 for the SHA-NI asm.
>> fpc-devel maillist - fpc-devel at lists.freepascal.org
> fpc-devel maillist - fpc-devel at lists.freepascal.org
More information about the fpc-devel