<commit_before># Scrypt plugin for iOS

## Introduction

[scrypt](http://www.tarsnap.com/scrypt.html) is a password-based key derivation function designed to make it costly to perform hardware attacks on the derived keys. While there exist scrypt implentations for the browser in javascript they are extremely slow and impractical for use in mobile apps.

This plugin is for use with [Cordova](http://incubator.apache.org/cordova/) and allows your application to use scrypt on iOS devices using native C code. It is based on [libscrypt](https://github.com/technion/libscrypt).

### Contents

- [Installation](#installation)
- [Plugin API](#plugin-api)
- [LICENSE](#license)

##<a name="installation"></a>Installation

Below are the methods for installing this plugin automatically using command line tools. For additional info, take a look at the [Plugman Documentation](https://github.com/apache/cordova-plugman/blob/master/README.md) and [Cordova Plugin Specification](https://github.com/alunny/cordova-plugin-spec).

### Cordova

The plugin can be installed via the Cordova command line interface:

* Navigate to the root folder for your phonegap project.
* Run the command:

```sh
cordova plugin add https://github.com/Crypho/com.crypho.plugins.scrypt.git
```

##<a name="plugin_api"></a> Plugin API

Grab the plugin instance variable.

```js
var scrypt;

document.addEventListener("deviceready", function(){
    scrypt = window.plugins.scrypt;
    ...
});
```

You can get the derived key in hexadecimal format by invoking ``scrypt(onSuccess, onFailure, password, salt, options)``

```js
var key;

scrypt(
    function (res) { key = res; },
    function (err) { key = null },
    'password', '<PASSWORD>', {N: 16384}
)<commit_msg>Added to plugman<commit_after># Scrypt plugin for iOS

## Introduction

[scrypt](http://www.tarsnap.com/scrypt.html) is a password-based key derivation function designed to make it costly to perform hardware attacks on the derived keys. While there exist scrypt implentations for the browser in javascript they are extremely slow and impractical for use in mobile apps.

This plugin is for use with [Cordova](http://incubator.apache.org/cordova/) and allows your application to use scrypt on iOS devices using native C code. It is based on [libscrypt](https://github.com/technion/libscrypt).

### Contents

- [Installation](#installation)
- [Plugin API](#plugin-api)
- [LICENSE](#license)

##<a name="installation"></a>Installation

Below are the methods for installing this plugin automatically using command line tools. For additional info, take a look at the [Plugman Documentation](https://github.com/apache/cordova-plugman/blob/master/README.md) and [Cordova Plugin Specification](https://github.com/alunny/cordova-plugin-spec).

### Cordova

The plugin can be installed via the Cordova command line interface:

* Navigate to the root folder for your phonegap project.
* Run the command:

```sh
cordova plugin add com.crypho.plugins.scrypt
```

or if you want to be running the development version,

```sh
cordova plugin add https://github.com/Crypho/com.crypho.plugins.scrypt.git
```

##<a name="plugin_api"></a> Plugin API

Grab the plugin instance variable.

```js
var scrypt;

document.addEventListener("deviceready", function(){
    scrypt = window.plugins.scrypt;
    ...
});
```

You can get the derived key in hexadecimal format by invoking ``scrypt(onSuccess, onFailure, password, salt, options)``

```js
var key;

scrypt(
    function (res) { key = res; },
    function (err) { key = null },
    'password', '<PASSWORD>', {N: 16384}
)
{'fraction_non_alphanumeric': 0.1171875, 'fraction_numerical': 0.0027901785714285715, 'mean_word_length': 4.6545741324921135, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3239980', 'n_tokens_mistral': 1099, 'n_tokens_neox': 1034, 'n_words': 385}