hwsl2

1.0.0 • Public • Published

Hashing with SL2

An algebraic hash function, inspired by the paper Hashing with SL2 by Tillich and Zemor.

The hash function is based on matrix multiplication in the special linear group of degree 2, over a Galois field of order 2^127, with all computations modulo the polynomial x^127 + x^63 + 1.

This construction gives some nice properties, which traditional bit-scambling hash functions don't possess, including it being composable. It holds:

Hash.hash(m1 + m2, function (err, h) {
  Hash.hash(m1, function (err, h1) {
    Hash.hash(m2, function (err, h2) {
      assert(h.equals(h1.concat(h2)));
    });
  );
});

Following that, the hash function is also parallelisable. If a message m can be divided into a list of chunks cs, the hash of the message can be calculated in parallel:

async.map(cs, Hash.hash, function (err, hs) {
  hs.reduce(function (a, b) { return a.concat(b); }, Hash.empty());
});

All operations in this package are implemented in a very efficient manner using SSE instructions.

diagram

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i hwsl2

    Weekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • srijs