Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cpp/src/bch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ class Bch {
}
}
if (found != degree || found > t_) return false;
for (size_t i = data.size(); i < static_cast<size_t>(data_length); ++i) {
if (received[i] != '0') return false;
}
data = received.substr(0, data.size());
ecc = received.substr(data_length);
return ecc == parity(data);
Expand Down
12 changes: 12 additions & 0 deletions js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ To run the example:

To use the code in your own project, simply include the two JavaScript files as usual.

## BCH library

[`deps/bch_ecc.js`](deps/bch_ecc.js) contains the readable BCH source. The example loads
[`deps/bch_ecc.min.js`](deps/bch_ecc.min.js), generated from that source without obfuscation.
After changing the source, regenerate the minified file from the `js` directory:

```sh
npx --yes esbuild@0.27.4 deps/bch_ecc.js --minify --target=es2020 --legal-comments=inline --outfile=deps/bch_ecc.min.js
```

Run the CPU-only ECC regressions against both files with `node --test test-ecc.cjs`.

## Example output

For an image containing a TrustMark watermark:
Expand Down
Loading
Loading