From 27922e0f93c3589fef7cb376bf88a223cb80d3a5 Mon Sep 17 00:00:00 2001 From: zhiqiangxu <652732310@qq.com> Date: Sat, 20 May 2023 22:25:40 +0800 Subject: [PATCH 1/2] fix comment --- common/safe_prime.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/safe_prime.go b/common/safe_prime.go index fad2d1f1..179e35ee 100644 --- a/common/safe_prime.go +++ b/common/safe_prime.go @@ -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, From 4c83ace88ccd46224907d5b3d2d7525d4e8be677 Mon Sep 17 00:00:00 2001 From: zhiqiangxu <652732310@qq.com> Date: Sat, 20 May 2023 22:44:25 +0800 Subject: [PATCH 2/2] size of #concurrency is enough for errCh --- common/safe_prime.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/safe_prime.go b/common/safe_prime.go index 179e35ee..8ca74468 100644 --- a/common/safe_prime.go +++ b/common/safe_prime.go @@ -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{}