Skip to content

Commit

Permalink
Merge pull request #246 from zhiqiangxu/fix_comment_of_runGenPrimeRou…
Browse files Browse the repository at this point in the history
…tine

[nit] fix comment and minor optimize `GetRandomSafePrimesConcurrent`
  • Loading branch information
ZhAnGeek authored Jan 11, 2024
2 parents c76a1a5 + 4c83ace commit c8136c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common/safe_prime.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func GetRandomSafePrimesConcurrent(ctx context.Context, bitLen, numPrimes int, c
}

primeCh := make(chan *GermainSafePrime, concurrency*numPrimes)
errCh := make(chan error, concurrency*numPrimes)
errCh := make(chan error, concurrency)
primes := make([]*GermainSafePrime, 0, numPrimes)

waitGroup := &sync.WaitGroup{}
Expand Down Expand Up @@ -194,7 +194,7 @@ func GetRandomSafePrimesConcurrent(ctx context.Context, bitLen, numPrimes int, c
// `q` in point 2. If `p` is not coprime to at least one element of the
// `smallPrimes`, then go back to point 1.
// If `p` is coprime to all the elements of `smallPrimes`, go to point 5.
// 5. At this point, we know `q` is potentially prime, and `p=q+1` is also
// 5. At this point, we know `q` is potentially prime, and `p=2q+1` is also
// potentially prime. We need to execute a final primality test for `q`.
// We apply Miller-Rabin and Baillie-PSW tests. If they succeed, it means
// that `q` is prime with a very high probability. Knowing `q` is prime,
Expand Down

0 comments on commit c8136c9

Please sign in to comment.