1.0.21 • Published 8 years ago

skein v1.0.21

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

skein

Compact and fast 512-bit encryption add-on for node.js using Skein hash functions.

What is Skein?

Skein is a family of cryptographic hash functions. Skein’s design combines speed, security, simplicity, and a great deal of flexibility in a modular package that is easy to analyze. 1

What is skein add-on?

Skein add-on wraps original Skein C implementation. The add-on makes Skein available for node.js packages without sacrificing its speed. The wrapper includes a 512-bit hash function and a pair of 512-bit symmetric encryption functions.

Status

The add-on is currently available for Linux, OS X and Windows platforms. Raspbian build is in progress and it will be available soon. Please stay tuned and check out this page for further news.

How do I install?

npm install skein

skein functions

The following functions are currently available from the skein add-on. These functions are asynchronous in nature and conforms to node.js 'error-first' callback convention. Argument errors can cause exceptions to be thrown.

calcHash

The method calcHash takes a string argument and returns a 512-bit (64-byte) hash value in a Buffer object. The Buffer object is NOT stored internally. The Buffer object can be used as a key in the encrypt and decrypt functions.

var skein = require('skein');
var crypto = new skein.Crypto();
crypto.calcHash("my top secret password", function (err, hash) {
   assert.equal(err, null);
   assert.equal(hash.length, 64);
});

encrypt

The method encrypt takes a 64-byte hash value as a key, a String object to encrypt, and a function object to return encrypted binary data in a Buffer object. Typically the hash value is calculated using the calcHash function although it does not have to be.

var skein = require('skein');
var crypto = new skein.Crypto();
crypto.calcHash("my top secret password", function (err, hash) {
   assert.equal(err, null);
   assert.equal(hash.length, 64);
   var text = "Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν";
   crypto.encrypt(hash, text, function (err, encrypted) {
      assert.equal(err, null);
      assert.equal(encrypted.length, 76);
      done();
   });
});

decrypt

The method decrypt takes a 64-byte hash value as a key, a binary Buffer object to decrypt, and a function object to return decrypted data in a String object. Typically the hash value is calculated using the calcHash function although it does not have to be.

var skein = require('skein');
var crypto = new skein.Crypto();
crypto.calcHash("my top secret password", function (err, hash) {
   assert.equal(err, null);
   assert.equal(hash.length, 64);
   var text = "Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν";
   crypto.encrypt(hash, text, function (err, encrypted) {
      assert.equal(err, null);
      crypto.decrypt(hash, encrypted, function (err, decrypted) {
         assert.equal(err, null);
         assert.equal(decrypted, text);
         done();
      });
   });
});

Acknowledgement

Skein was developed by Niels Ferguson, Stefan Lucks, Bruce Schneier, Doug Whiting, Mihir Bellare, Tadayoshi Kohno, Jon Callas, Jesse Walker.

Reference

1 Skein website

1.0.21

8 years ago

1.0.20

8 years ago

1.0.18

8 years ago

1.0.17

8 years ago

1.0.16

8 years ago

1.0.15

10 years ago

1.0.14

10 years ago

1.0.13

10 years ago

1.0.12

10 years ago

1.0.11

10 years ago

1.0.10

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago