projects
/
shamirs
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix share id == 0 check for share at index 0
[shamirs]
/
main.c
diff --git
a/main.c
b/main.c
index a46dda1e094f9834236c05fddc3123f2fc82025b..af5a7d791425ac764d77ffeb10640ad2186e4b24 100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-201,7
+201,7
@@
int main(int argc, char* argv[]) {
// TODO: The following loop may take a long time and eat lots of /dev/random if total_shares is high
for (uint32_t i = 0; i < total_shares; i++) {
// TODO: The following loop may take a long time and eat lots of /dev/random if total_shares is high
for (uint32_t i = 0; i < total_shares; i++) {
- int32_t j =
0
;
+ int32_t j =
-1
;
do {
assert(fread(&x[i], sizeof(uint8_t), 1, random) == 1);
if (x[i] == 0)
do {
assert(fread(&x[i], sizeof(uint8_t), 1, random) == 1);
if (x[i] == 0)
@@
-209,7
+209,7
@@
int main(int argc, char* argv[]) {
for (j = 0; j < i; j++)
if (x[j] == x[i])
break;
for (j = 0; j < i; j++)
if (x[j] == x[i])
break;
- } while (j < i); // Inner loop will get to j = i when x[j] != x[i] for all j
+ } while (j <
(int32_t)
i); // Inner loop will get to j = i when x[j] != x[i] for all j
if (i % 32 == 31)
printf("Finished picking X coordinates for %u shares\n", i+1);
}
if (i % 32 == 31)
printf("Finished picking X coordinates for %u shares\n", i+1);
}