File tree Expand file tree Collapse file tree 3 files changed +6
-38
lines changed
core/src/main/java/org/bouncycastle/crypto/threshold Expand file tree Collapse file tree 3 files changed +6
-38
lines changed Original file line number Diff line number Diff line change @@ -13,13 +13,4 @@ public interface SecretSplitter
1313 * @return An array of {@code byte[][]} representing the generated secret shares for m users with l bytes each.
1414 */
1515 SplitSecret split ();
16-
17- /**
18- * Recombines secret shares to reconstruct the original secret.
19- *
20- * @param rr The threshold number of shares required for recombination.
21- * @param splits A vector of byte arrays representing the shares, where each share is l bytes long.
22- * @return A byte array containing the reconstructed secret.
23- */
24- byte [] recombineShares (int [] rr , byte []... splits );
2516}
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ public enum Mode
1717 Table
1818 }
1919
20- private Polynomial poly ;
20+ private final Polynomial poly ;
2121 /**
2222 * Length of the secret
2323 */
@@ -78,32 +78,4 @@ public ShamirSplitSecret split()
7878 }
7979 return new ShamirSplitSecret (poly , secretShares );
8080 }
81-
82- public byte [] recombineShares (int [] rr , byte []... splits )
83- {
84- int n = rr .length ;
85- byte [] r = new byte [n ];
86- byte tmp ;
87- byte [] products = new byte [n - 1 ];
88- for (int i = 0 ; i < n ; i ++)
89- {
90- tmp = 0 ;
91- for (int j = 0 ; j < n ; j ++)
92- {
93- if (j != i )
94- {
95- products [tmp ++] = poly .gfDiv (rr [j ], rr [i ] ^ rr [j ]);
96- }
97- }
98-
99- tmp = 1 ;
100- for (byte p : products )
101- {
102- tmp = (byte )poly .gfMul (tmp & 0xff , p & 0xff );
103- }
104- r [i ] = tmp ;
105- }
106-
107- return poly .gfVecMul (r , splits );
108- }
10981}
Original file line number Diff line number Diff line change @@ -4,5 +4,10 @@ public interface SplitSecret
44{
55 SecretShare [] getSecretShare ();
66
7+ /**
8+ * Recombines secret shares to reconstruct the original secret.
9+ *
10+ * @return A byte array containing the reconstructed secret.
11+ */
712 byte [] recombine ();
813}
You can’t perform that action at this time.
0 commit comments