Git Product home page Git Product logo

keccak-p-js's Introduction

keccak-p-js

A sha-3 winner Keccak-p implementation in JavaScript

Getting the Code

To get a local copy of the current code, clone it using git:

$ git clone git://github.com/jeffallen6767/keccak-p-js.git
$ cd keccak-p-js

If everything worked out, install all dependencies:

$ npm install

Run the tests:

$ npm run tests

Use it in you own project:

$ npm install git://github.com/jeffallen6767/keccak-p-js.git --save

or

$ npm install https://github.com/jeffallen6767/keccak-p-js.git --save

Use it in your code ( see test.js for in-depth examples and details ):

var keccak = require("keccak-p-js");

// sync example:
var hash = keccak.mode("SHA-3-256").init().update("abc").digest();
console.log("sync SHA-3-256 of abc is ", hash);

// async example:
keccak.mode("SHA-3-256", function(mode) {
  mode.init(function(input) {
    input.update("abc", function(output) {
      output.digest(function(hash) {
        console.log("async SHA-3-256 of abc is ", hash);
      });
    });
  });
});

Supports the following modes:

SHA-3-224
SHA-3-256
SHA-3-384
SHA-3-512

and

SHAKE-128
SHAKE-256

How to SHAKE-n:

  • create an instance using a valid shake mode
  • update the instance with input to be hashed
  • call instance.digest(n-bytes) 1..n times to create n bytes of hash
var shake = keccak.mode("SHAKE-256").init().update("abc"),
  hash = [
    shake.digest(32),
    shake.digest(16),
    shake.digest(8),
    shake.digest(5),
    shake.digest(3)
  ].join("");

console.log("sync 64 bytes of SHAKE-256 of abc is ", hash);

keccak-p-js's People

Contributors

jeffallen6767 avatar

Watchers

 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.