File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -111,14 +111,18 @@ RETRY:
111
111
}
112
112
113
113
// Ensure f(x) and h(x) are not linear depending by checking it's coefficients
114
+ // f(x) = f1x + f0 => f(x)/f0 = f1/f0 * x + 1
115
+ // h(x) = h1x + h0 => h(x)/h1 = h1/h0 * x + 1
116
+ // by comparing the ratio of f1/f0 and h1/h0, we can ensure that f(x) and h(x) are not linear dependent
114
117
revF0 := new (big.Int ).ModInverse (f0 , prime )
115
118
revH0 := new (big.Int ).ModInverse (h0 , prime )
116
119
117
120
f1RevF0 := new (big.Int ).Mul (f1 , revF0 )
118
- f2RevH0 := new (big.Int ).Mul (f1 , revH0 )
121
+ h1RevH0 := new (big.Int ).Mul (h1 , revH0 )
122
+
119
123
f1RevF0 .Mod (f1RevF0 , prime )
120
- f2RevH0 .Mod (f2RevH0 , prime )
121
- if f1RevF0 .Cmp (f2RevH0 ) == 0 {
124
+ h1RevH0 .Mod (h1RevH0 , prime )
125
+ if f1RevF0 .Cmp (h1RevH0 ) == 0 {
122
126
goto RETRY
123
127
}
124
128
You can’t perform that action at this time.
0 commit comments