logoalt Hacker News

secondcoming • today at 10:23 AM • 3 replies • view on HN

I wanted to see how OpenSSL handles the x64 instructions to accelerate SHA1 hashing and it turns out the assembly code is generated by a perl script.


Replies

cowlevel • today at 1:09 PM

That's normal, if outdated - you'd use Python in anything written since 2010

actionfromafar • today at 10:42 AM

That's not automatically bad, in fact it can be better than just inlining the instructions. I won't judge this instance of the pattern, but if faced with (perhaps incomplete at the time) intrinsics, or hand coded inline assembly, vs generating with an external script (or "mini compiler" if you will), it might be less error prone to generate.

pseudohadamard • today at 2:07 PM

Assuming you mean x86, that part was originally written around 30 years ago via this funky setup that did MD5 and SHA-1 from the same code. It's not really any kind of example of current practice.

➕ show 1 reply