[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scrypt has three different implementations of crypto_scrypt(), ref, sse, and nosse. What do they mean?



If you look into the scrypt codebase, you will find three files:

    crypto_scrypt-nosse.c
    crypto_scrypt-sse.c
    crypto_scrypt-ref.c

All of them implement the same function crypto_scrypt() in different ways.

I have noticed these things about them:

* All of them give the same output for the same input. (For the data I
tried, at least.)

* The ref implementation makes the algorithm use approximately 128*N*r
bytes of memory.

* The sse and nosse implementations use much less memory. They seem to
disregard the parameters for determining memory usage entirely.

My questions are these:

1. Can you explain the differences between nosse, sse, and ref? What's the
point?

2. I find it strange that sse and nosse use much less memory. Only ref
uses a predictable amount of memory 128*N*r. But if the others can beat
ref, what's the point of ref?

3. Finally, a C question: I was able to put all three .c files into my
project and compile without errors. I find this strange. I was expecting
to get a "duplicate symbols" error from my linker because crypto_scrypt()
is implemented in all three files. So my question is, why don't I get any
errors?