Giter Club home page Giter Club logo

reed-solomon's People

Contributors

jorangreef avatar olalonde avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reed-solomon's Issues

Detecting silent bit errors?

Hey!

Thank you a lot for your great work! Your implementation is blazingly fast! :)

I have a slightly different use case. I want to detect silent bit errors (resp. damaged shards) and don't know my sources and targets.

Do you see any possibility to add some kind of check() method to your module that returns damaged shards?

Of course we will need at least two parity shards to achieve that. If I a correct with m=2 we can detect if 2 shards are damaged and repair if 1 shard is damaged.

Let me know what you think.

ReedSolomon k+1 broken if parity buffer is not zero'ed

Stumbled upon this one. Reproduced using the attached mocha test (renamed as .txt for github upload)
rononmon.test.txt

Execution gives out:

$ npm test test/rononmon.test.js

> [email protected] test /home/mlubin/dev/ecstream
> mocha --use_strict --check-leaks --no-exit  "test/rononmon.test.js"



  ✓ Test parity initialization - m=1, initValue=0
  1) Test parity initialization - m=1, initValue=255
  ✓ Test parity initialization - m=2, initValue=0
  ✓ Test parity initialization - m=2, initValue=255

  3 passing (13ms)
  1 failing

  1)  Test parity initialization - m=1, initValue=255:

      Uncaught AssertionError: <Buffer db db db db db db db db> === <Buffer 24 24 24 24 24 24 24 24>
      + expected - actual

       [
      -  219
      -  219
      -  219
      -  219
      -  219
      -  219
      -  219
      -  219
      +  36
      +  36
      +  36
      +  36
      +  36
      +  36
      +  36
      +  36
       ]
      
      at ReedSolomon.encode.err (test/rononmon.test.js:38:36)

Handling of m=1 seems very special. Looking at binding.cc code I found the special code path which directly call dot_xor and do not start with a dot_cpy first:

diff --git a/binding.cc b/binding.cc
index b61ecdd..c323b3e 100644
--- a/binding.cc
+++ b/binding.cc
@@ -705,8 +705,16 @@ void encode(
   ) {
     // Optimization for 1 erasure (i < k + 1), encoding only targets:
     uint8_t* target = shards[flags_first(targets)];
+    int copied = 0;
     for (int i = 0; i < k + 1; i++) {
-      if (sources & (1 << i)) dot_xor(shards[i], target, shardSize);
+      if (sources & (1 << i)) {
+        if (!copied) {
+          dot_cpy(shards[i], target, shardSize);
+          copied = 1;
+        } else {
+          dot_xor(shards[i], target, shardSize);
+        }
+      }
     }
     return;
   }

Can be reproduced in your test by forcing random parity buffers in test.js:

diff --git a/test.js b/test.js
index ef462e9..1c1f902 100644
--- a/test.js
+++ b/test.js
@@ -317,7 +317,7 @@ queue.onData = function(args, end) {
   );
   var buffer = cipher.update(Buffer.alloc(bufferOffset + bufferSize));
   Assert(buffer.length === bufferOffset + bufferSize);
-  var parity = Buffer.alloc(parityOffset + paritySize);
+  var parity = Node.crypto.randomBytes(parityOffset + paritySize);
   if (parityOffset) {
     Assert(
       cipher.update(Buffer.alloc(parityOffset)).copy(parity, 0) === parityOffset

The above patch fixes the issue, at least on the simple test I attached and your tests.

Cheers,
Maxime

pure JS implementation that can used on the browser ?

Hi,
I am trying to find an implementation that can be used on browser. The goal is to have the erasure coding be performed on the browser and upload the multiple splits to multiple servers.

Any ideas or recommendations ?

Cannot find module './binding.node'

Error: Cannot find module './binding.node'
Require stack:

  • E:\nodejs\reed-solomon-master\benchmark.js
    �[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)�[39m
    �[90m at Function.Module._load (internal/modules/cjs/loader.js:864:27)�[39m
    �[90m at Module.require (internal/modules/cjs/loader.js:1044:19)�[39m
    �[90m at require (internal/modules/cjs/helpers.js:77:18)�[39m
    at Object. (E:\nodejs\reed-solomon-master\benchmark.js:8:19)
    �[90m at Module._compile (internal/modules/cjs/loader.js:1158:30)�[39m
    �[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)�[39m
    �[90m at Module.load (internal/modules/cjs/loader.js:1002:32)�[39m
    �[90m at Function.Module._load (internal/modules/cjs/loader.js:901:14)�[39m
    �[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)�[39m {
    code: �[32m'MODULE_NOT_FOUND'�[39m,
    requireStack: [ �[32m'E:\nodejs\reed-solomon-master\benchmark.js'�[39m ]
    }

I am getting Cannot find module './binding.node' error you have used
var ReedSolomon = require('./binding.node'); code in line no 5 of test.js code

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.