kmaragon / Konscious.Security.Cryptography

MIT License
202 stars 20 forks source link

BLAKE2 SIMD Intrinsic #36

Closed ryanelian closed 4 years ago

ryanelian commented 4 years ago

Hi. First, thanks for making this awesome password hashing library.

I found this another BLAKE2 C# repository which uses SIMD intrinsic for increased performance:

https://github.com/saucecontrol/Blake2Fast

(There is a benchmark vs Konscious BLAKE2 implementation down there in the project README)

I'm wondering if your Argon2 implementation can be further optimized by utilizing BLAKE2 with hardware intrinsic for improved security?

(Our services can increase the iteration count with the improved performance bonus)


EDIT:

Experiment note:

Tried substituting your HMACBlake2B library call with Blake2Fast implementation, however the results don't match for some reason. (Huh) Not sure what went wrong...

image

image

    Assert.Equal() Failure
                                     ↓ (pos 32)
    Expected: ···/4$o2UAJy0hmoE6I7uC.CEI1BRBmq8HKjqJ+UmWczwk8
    Actual:   ···/4$o2UAJy0hmoE6I7uC.kczKAp5XFNIjsvRUnEsGRKAE
                                     ↑ (pos 32)

EDIT 2: using libsodium, closing.