416d2fce990423bc91ec315dad17f1a8e487a0ab
[shamirs] / shamirssecret.h
1 #include <stdint.h>
2
3 #define P 256
4
5 /**
6  * Calculates the Y coordinate that the point with the given X
7  * coefficients[0] == secret, the rest are random values
8  */
9 uint8_t calculateQ(uint8_t coefficients[], uint8_t shares_required, uint8_t x);
10
11 /**
12  * Derives the secret given a set of shares_required points (x and q coordinates)
13  */
14 uint8_t calculateSecret(uint8_t x[], uint8_t q[], uint8_t shares_required);