sharplispers / ironclad

A cryptographic toolkit written in Common Lisp
BSD 3-Clause "New" or "Revised" License
166 stars 28 forks source link

Big time discrepancy for creating scrypt hashes #70

Closed mdbergmann closed 6 months ago

mdbergmann commented 6 months ago

Hello.

This is just a question.

I found that for scrypt there are big differences on the 3 CL implementations I tried:

Generating a scrypt hash with the default settings takes:

Can you tell why it is so slow on LW and ABCL? Or maybe the other way around, why is it so fast on SBCL.

glv2 commented 6 months ago

SBCL is usually good at optimizing fixnum arithmetic functions when generating the machine code, which is what cryptographic primitives use a lot. Moreover, Scrypt uses the Salsa cipher internally, and we have an optimized version (assembly) of Salsa's core for SBCL.

mdbergmann commented 6 months ago

Thanks.