# erlscrypt: Port driver for Colin Percival's "scrypt" function

[scrypt](, a Password-Based Key
Derivation Function from Colin Percival, from [version
1.1.6]( of his library.

For general background on what `scrypt` is, and why it's useful, see
[these slides (PDF)](
and [Colin Percival's page on

## Windows environment setup x64
1. Install C++ build tools from
1. Select Build Tools and C++ CLI option and execute the installation 
1. Add environment variable `INCLUDE` with value `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.12.25827\include;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt;`
1. Add environment variable `LIB` with value `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.12.25827\lib\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\um\x64;`
1. Add `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.12.25827\bin\Hostx64\x64` to environment vairiable `PATH`
1. If while compiling there is an error while linking, execute `which link` verify if this is pointing to visual studio build tools folder. If not rename the other linker that is being fetched from the path.

## Using the library

The entry points are `erlscrypt:scrypt/6` and `erlscrypt:scrypt/7`.

## erlscrypt:scrypt([nif], Passwd, Salt, N, R, P, Buflen)

Atom `nif` can be passed as optional first parameter to gain some marginal speed over

Both `Passwd` and `Salt` must be binaries. `N`, `R`, and `P` control
the complexity of the password-derivation process. `Buflen` is the
number of bytes of key material to generate.

For some good choices for `N`, `R` and `P`, see [the


    1> erlscrypt:scrypt(<<"pleaseletmein">>, <<"SodiumChloride">>, 16384, 8, 1, 64).
    2> erlscrypt:scrypt(nif,<<"pleaseletmein">>, <<"SodiumChloride">>, 16384, 8, 1, 64).

## License
Please see LICENSE for more details