Encountered an intermittent panic when calling glass_pumpkin::prime::strong_check():
thread 'main' panicked at 'attempt to subtract with overflow', /home/jnichols/.cargo/registry/src/github.com-1ecc6299db9ec823/glass_pumpkin-0.5.0/src/common.rs:176:25
trials may be zero, so the subtraction in the range definition can underflow.
If I understand the Miller Rabin algorithm properly, then I think a larger issue lies in rewrite():
https://github.com/mikelodder7/glass_pumpkin/blob/412a51b8235187c980a0194b6eae44ff02ac89aa/src/common.rs#L176
Encountered an intermittent panic when calling glass_pumpkin::prime::strong_check():
trials
may be zero, so the subtraction in the range definition can underflow.If I understand the Miller Rabin algorithm properly, then I think a larger issue lies in rewrite():
https://github.com/mikelodder7/glass_pumpkin/blob/412a51b8235187c980a0194b6eae44ff02ac89aa/src/common.rs#L192-L202
I think
rewrite()
is trying to findr
(aka trials) andd
from the following line in the algorithm, as given on wikipedia:However the current
rewrite()
function simply returnstrials = 0
andd = candidate - 1
(makingd
always positive) whenevercandidate
is odd.