<commit_before>node-polarssl
=============

Node.JS bindings for [PolarSSL](https://polarssl.org/), a clean, lightweight
crypto library.

Overview
--------

PolarSSL is a lot easier to reason about than OpenSSL, and has a nicer API that
can be exposed in node with less abstraction. Hopefully this module will be able
to form the base of an alternative for the built-in `crypto` and `tls` modules.

Warning
-------

Right now everything here is very very fluid. API's might change with a moment's
notice, and the version of this module on npm will likely be out of date. Please
clone directly from git://github.com/deoxxa/node-polarssl.git if you want to see
how things are doing.

Functionality
-------------

Most of this stuff mirrors the core [crypto api](http://nodejs.org/docs/latest/api/crypto.html),
so take a look at the official docs for more details. If an implemented method
in this module doesn't behave as specified in the official docs, it's a bug.
There are some additional methods as well, so read through this list for the
whole story.

### polarssl.createHash

```js
var hash = polarssl.createHash("md5");
```

### polarssl.Hash

This is a duplex stream - write data in, get digest out on `end()`.

```js
var hash = new polarssl.Hash("md5");
```

### polarssl.Hash.update

```js<commit_msg>document very roughly the cipher bits and pieces<commit_after>node-polarssl
=============

Node.JS bindings for [PolarSSL](https://polarssl.org/), a clean, lightweight
crypto library.

Overview
--------

PolarSSL is a lot easier to reason about than OpenSSL, and has a nicer API that
can be exposed in node with less abstraction. Hopefully this module will be able
to form the base of an alternative for the built-in `crypto` and `tls` modules.

Warning
-------

Right now everything here is very very fluid. API's might change with a moment's
notice, and the version of this module on npm will likely be out of date. Please
clone directly from git://github.com/deoxxa/node-polarssl.git if you want to see
how things are doing.

Functionality
-------------

Most of this stuff mirrors the core [crypto api](http://nodejs.org/docs/latest/api/crypto.html),
so take a look at the official docs for more details. If an implemented method
in this module doesn't behave as specified in the official docs, it's a bug.
There are some additional methods as well, so read through this list for the
whole story.

### polarssl.createCipher

```js
var hash = polarssl.createCipher("ARC4-128", key=Buffer("..."), iv=Buffer("..."), mode=0);
```

### polarssl.Cipher

This is a duplex stream - write cleartext in, get ciphertext out.

```js
var cipher = new polarssl.Cipher("md5");
```

### polarssl.Cipher.update

```js
cipher.update(Buffer("this is some data"));
```

### polarssl.Cipher.updateAsync

```js
cipher.updateAsync(Buffer("this is some data"), function(err) {
  if (err) {
    return console.warn(err);
  }
});
```

### polarssl.Cipher.final

```js
var data = cipher.final();
```

### polarssl.Cipher.finalAsync

```js
cipher.finalAsync(function(err, data) {
  if (err) {
    return console.warn(err);
  }

  console.log(data);
});
```

### polarssl.createHash

```js
var hash = polarssl.createHash("md5");
```

### polarssl.Hash

This is a duplex stream - write data in, get digest out on `end()`.

```js
var hash = new polarssl.Hash("md5");
```

### polarssl.Hash.update

```js
{'fraction_non_alphanumeric': 0.13500738552437222, 'fraction_numerical': 0.0029542097488921715, 'mean_word_length': 3.893063583815029, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, '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': '1233181', 'n_tokens_mistral': 1062, 'n_tokens_neox': 986, 'n_words': 422}