Skip to content

Commit

Permalink
Add license and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
FooBarWidget committed Oct 6, 2012
1 parent 44a8cb5 commit 9d39ea1
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
9 changes: 9 additions & 0 deletions LICENSE
@@ -0,0 +1,9 @@
Copyright (c) 2012 Phusion

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

This package contains code written by the Keccak authors, which is licensed http://creativecommons.org/publicdomain/zero/1.0/
41 changes: 41 additions & 0 deletions README.md
@@ -0,0 +1,41 @@
# A Node.js C++ extension for SHA-3 (Keccak)

This Node.js extension implements the SHA-3 ([Keccak](http://keccak.noekeon.org/)) cryptographic hashing algorithm. It is based on the reference C implementation, version 3.2. The exposed interface is almost identical to that of the `crypto` standard library.

## Installation

TODO

## Usage

Keccak supports 5 hash lengths: 224-bit, 256-bit, 384-bit, 512-bit and variable length. Variable length is not supported by this Node.js extension. Unless the user specifies otherwise, this Node.js extension assumes 512-bit.

var SHA3 = require('sha3');

// Generate 512-bit digest.
var d = new SHA3.SHA3Hash();
d.update('foo');
d.digest('hex'); // => "1597842a..."

// Generate 224-bit digest.
var d = new SHA3.SHA3Hash(224);
d.update('foo');
d.digest('hex'); // => "daa94da7..."

### new SHA3Hash([hashlen])

This is the hash object. `hashlen` is 512 by default.

### hash.update(data, [input_encoding])

Updates the hash content with the given data, the encoding of which is given in `input_encoding` and can be `'utf8'`, `'ascii'` or `'binary'`. Defaults to `'binary'`. This can be called many times with new data as it is streamed.

### hash.digest([encoding])

Calculates the digest of all of the passed data to be hashed. The encoding can be `'hex'` or `'binary'`. Defaults to `'binary'`.

Note: unlike `crypto.Hash`, a `SHA3Hash` object _can_ still be used after the `digest()` method been called.

## Warning

Do not use SHA-3 for hashing passwords. Do not even use SHA-3 + salt for hashing passowords. Use a [slow hash](http://codahale.com/how-to-safely-store-a-password/) instead.

0 comments on commit 9d39ea1

Please sign in to comment.