Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2023-09

x86_64 SHA1 implementation (J. Gareth Moreton)

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Florian Klämpfl
to Arnaud Bouchez
Show quoted text 8 lines
Am 17.09.2023 um 08:45 schrieb Arnaud Bouchez via fpc-devel :  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.

Show quoted text 9 lines

Reply by email

J. Gareth Moreton
to Florian Klämpfl

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.

Kit

Florian Klämpfl wrote 23 lines
> Am 17.09.2023 um 08:45 schrieb Arnaud Bouchez via fpc-devel : > >  > 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. > > Arnaud > > _______________________________________________ > fpc-devel maillist - > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel > _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email