shamirs-secret-sharing-ts
Version:
A simple implementation of Shamir's Secret Sharing configured to use a finite field in GF(2^8) with 128 bit padding
15 lines (14 loc) • 449 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const constants_1 = require("./constants");
const table_1 = require("./table");
function horner(x, a) {
const n = constants_1.MAX_SHARES;
const t = a.length - 1;
let b = 0;
for (let i = t; i >= 0; --i) {
b = 0 === b ? a[i] : table_1.exps[(table_1.logs[x] + table_1.logs[b]) % n] ^ a[i];
}
return b;
}
exports.horner = horner;