Split out UI into separate main.c file
[shamirs] / shamirssecret.h
diff --git a/shamirssecret.h b/shamirssecret.h
new file mode 100644 (file)
index 0000000..416d2fc
--- /dev/null
@@ -0,0 +1,14 @@
+#include <stdint.h>
+
+#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);