GithubHelp home page GithubHelp logo

isabella232 / node-sha3 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brave/node-sha3

0.0 0.0 0.0 2.06 MB

A Node.js C++ extension for SHA-3 (Keccak)

Home Page: https://www.npmjs.com/package/sha3

License: Other

Python 3.50% C 0.29% C++ 89.13% JavaScript 7.07%

node-sha3's Introduction

A Node.js C++ extension for SHA-3 (Keccak)

This Node.js extension implements the SHA-3 (Keccak) 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.

Build Status

Installation

npm install sha3

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.

Running the test suite

Run the test suite as follows:

npm test

The test suite is automatically generated from Keccak's reference test suite. It requires that you have Python 2.7 installed and available via the python executable.

Warning

Do not use SHA-3 for hashing passwords. Do not even use SHA-3 + salt for hashing passowords. Use a slow hash instead.

See also

Digest::SHA3 for Ruby

node-sha3's People

Contributors

5at avatar foobarwidget avatar ltilve avatar mattkelly avatar parkr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.