Shamir's secret sharing scheme for javascript