Shamir secret sharing scheme implementation, tests and fixes