Add Argon2 memory-hard hashing and encoding#2773
Add Argon2 memory-hard hashing and encoding#2773NotsoanoNimus wants to merge 23 commits intoc3lang:masterfrom
Conversation
|
Nice, I'll test this later. Just a reminder that https://github.com/c3lang/c3c/blob/master/lib/std/hash/blake3.c3#L67 isn't working and to replace it with something like #2727 (comment) |
|
Great! Thanks in advance, @ManuLinares. And I appreciate the reminder: I have that code change hanging around in my SHA-3 branch but I haven't pushed it up yet. My next target is to finally finish that PR and open it for review, so it should be fixed then. |
|
We got a bunch of tests that are failing because unfortunately they are comparing with code that depends on the line numbers of certain functions, the right way to fix this is to cut away the line number parts of the comparison text. |
|
When compiled with 10 instructions are about 1 LOC, so those are 1400 and 2400 lines long functions. Very long functions are relatively slow to codegen in LLVM and may end up less efficient due to cache concerns. |
|
This unfortunately now have some merge conflicts. |
👍 Will resolve, along with reducing instruction counts, when I return to my workstation in a few hours. |
|
one more thing you could do, extract the logic for parsing a single parameter into a separate helper |
Implements Argon2 in accordance with RFC 9106 and establishes a canonical way to encode/decode Argon2 hash strings with their included options. This is a known standard, the PHC-SF.
Also includes a small rework of the inflexible way BLAKE2 hashing worked, in order to accommodate runtime hash lengths. This should be acceptable without deprecation notices since this change comes within the same compiler/stdlib version as BLAKE2's implementation.
If you want to know how to use Argon2, please see the related unit-test file.
Future versions of this software should aim to make use of SIMD optimizations for each parallel processing lane, and for the underlying BLAKE2-like round function. At the moment, this sort of optimization is left for the C3 compiler to take care of.