Math & science

Erasure-Coding Playground

Reed–Solomon over GF(256): encode data into k + m shards, lose some, rebuild it.

Up to 4,096 bytes. Text is encoded as UTF-8.

Shards to delete before reconstruction: D1…Dk (data), P1…Pm (parity) or numbers 1…k+m. Leave empty to only encode.

Try an example: RS(4,2): lose two data shards · RS(6,3) like many object stores, three shards lost · Too many losses (3 of RS(3,2))

How it works

Splits your text or bytes into k data shards, adds m Reed–Solomon parity shards computed over GF(256), lets you drop any shards and reconstructs the original from any k survivors. Shows the generator and decoding matrices, the shard bytes in hex, and compares storage overhead and fault tolerance with replication and RAID-5 style XOR parity.

  • Arithmetic is in the finite field GF(2^8) with the primitive polynomial x^8 + x^4 + x^3 + x^2 + 1 (0x11d): addition is XOR, multiplication uses log/antilog tables of the generator 2.
  • The data is split into k equal shards (zero-padded at the end). The n × k generator matrix is the k × k identity (so data shards are stored as is: a systematic code) on top of an m × k Cauchy matrix C[i][j] = 1 / (x_i + y_j) with x_i = k + i and y_j = j.
  • Every k × k submatrix of this generator is invertible, so any k of the n = k + m shards are enough (the code is MDS). Reconstruction inverts the rows of the surviving shards by Gauss–Jordan elimination over GF(256) and multiplies the survivors by that inverse.
  • RAID-5 style parity is the XOR of all data shards: it survives exactly one lost shard. Replication keeps m + 1 full copies, survives m losses, but costs (m + 1)× storage.

Sources

For scripts and AI agents

  • JSON API: POST https://erasurecodingplayground.usefulweb.site/api/v1/calculate (same calculation as this page)
  • Interface description: OpenAPI 3.1 · AI guide: llms.txt
  • MCP server (Streamable HTTP): https://erasurecodingplayground.usefulweb.site/mcp · tool name erasure_coding_playground
Example request
curl -s -X POST https://erasurecodingplayground.usefulweb.site/api/v1/calculate \
  -H 'content-type: application/json' \
  -d '{"data":"Hello, erasure coding!","encoding":"text","k":4,"m":2,"lost":"D1, D3"}'

Related tools

  • Number-Theory Lab – Primality, factorisation, gcd, modular arithmetic, CRT, φ, π(n), Collatz, continued fractions.
  • Floating-Point Explorer – See how IEEE-754 half/single/double store a number: bits, exact value, ULP, rounding error.
Feedback