This code returns the n Lagrange Interpolation Coefficients, coef[0], ... coef[n-1], in the linear combination of the surviving portions to produce the lost portion. r is the argument of the desired lost portion and av[0], ... av[n−1] are the arguments of the surviving portions.
void LagCoef(int n, char r, char av[n], char coef[n]);n, r and av are inputs. The Lagrange coefficients are placed in the array coef. n is 1+(the degree of the polynomial) and r is the argument of the missing portion. av[j] is the argument of the jth portion. If 0≤j<(size of portion) and Fkj is character j of portion k then the character j of the missing portion is Σ[0≤k<n]coef[k]∙Fkj. In this formula the multiplications and additions are for the field GF(256). See formula.
Routine tc illustrates deployment for one byte portions.
typedef unsigned long int ui; ui ww(ui a) {ui const m = 0x0101010101010101L; return ({ui h = a &m; h<<1^h<<2^h<<3^h<<5;}) ^ ({ui h = a>>1&m; h^h<<1^h<<3^h<<4^h<<6;}) ^ ({ui h = a>>2&m; h^h<<1^h<<3^h<<7;}) ^ ({ui h = a>>3&m; h<<2^h<<3^h<<5^h<<6;}) ^ ({ui h = a>>4&m; h<<3^h<<5^h<<6^h<<7;}) ^ ({ui h = a>>5&m; h<<1^h^h<<3^h<<2^h<<6;}) ^ ({ui h = a>>6&m; h^h<<1^h<<3^h<<6;}) ^ ({ui h = a>>7&m; h<<1^h<<3^h<<5;});}where argument is from plain hunk 0 returns some auxiliary hunk. About 64 ops compute the contribution of one plain file to one of the aux files. This gives 64 bits of results however. Notice that there are no conditional branches and virtually no critical path. This is ideal code for fast processors. The memory access pattern is also simple and cache friendly.
clang xx.c xy.c -O3 -Wmost; time ./a.outtests such a pattern. Most of the time goes to arc4random.
The loss of a terabyte data keeper would require about k ops per bit of reconstructed portions where k is the typical number of pay-load portions. These ops are mostly simple shift and xor ops with little critical path dependency. A terabyte is 1013 bits and a tera-op is less than 1000 seconds. If the number of pay-load portions is typically 20 then the work to recompute the lost terabyte is 2*1014 ops or 200000 seconds—two or three days. Normal file backup for most keepers should greatly diminish this cost.