X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=shamirs;a=blobdiff_plain;f=shamirssecret.h;fp=shamirssecret.h;h=416d2fce990423bc91ec315dad17f1a8e487a0ab;hp=0000000000000000000000000000000000000000;hb=5958ded10d4f4496f34ae8f5aad0b34153ed3dd6;hpb=39318502b0e2fedca71d901ba007fea2a0d26208 diff --git a/shamirssecret.h b/shamirssecret.h new file mode 100644 index 0000000..416d2fc --- /dev/null +++ b/shamirssecret.h @@ -0,0 +1,14 @@ +#include + +#define P 256 + +/** + * Calculates the Y coordinate that the point with the given X + * coefficients[0] == secret, the rest are random values + */ +uint8_t calculateQ(uint8_t coefficients[], uint8_t shares_required, uint8_t x); + +/** + * Derives the secret given a set of shares_required points (x and q coordinates) + */ +uint8_t calculateSecret(uint8_t x[], uint8_t q[], uint8_t shares_required);