Super-efficient prime number generation system based on ZKP multi-theorem fusion and RSA application
By dynamically selecting the Schnorr/Groth16 protocol and improving the AKS algorithm, RSA key pairs are generated, which solves the problems of low efficiency and insufficient security in generating large prime numbers, and achieves the effect of rapid generation and resistance to quantum attacks.
Patent Information
- Application Number
- CN202510606832.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-12
- Publication Date
- 2025-08-12
AI Technical Summary
The existing technology generates large prime numbers with low efficiency and is vulnerable to quantum computing attacks. The traditional Miller-Rabin algorithm takes more than 120 seconds to generate 2048-bit prime numbers, and does not integrate ZKP verification, so it is vulnerable to Shor algorithm attacks.
Dynamic ZKP fusion Schnorr/Groth16 protocol verification is used, and parallel computing and modular design are carried out in combination with improved AKS algorithm to generate RSA key pairs.
The 2048-bit prime generation time has been reduced from 120 seconds to 52 seconds, which is resistant to quantum attacks, and the misjudgment rate is less than 10^-6. It is compatible with traditional RSA and post-quantum encryption algorithms.
Smart Images

Figure CN120474711A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of cryptography and computer security, and is particularly suitable for RSA encryption scenarios (such as blockchain and financial transactions) that require rapid generation of large prime number pairs. Background Art
[0002] Defects of existing technology:
[0003] Low efficiency: The traditional Miller-Rabin algorithm takes more than 120 seconds to generate a 2048-bit prime number;
[0004] Insufficient security: ZKP verification is not integrated and it is vulnerable to quantum computing attacks (such as Shor's algorithm). Summary of the Invention
[0005] Core Innovation
[0006] Dynamic ZKP fusion: switching between Schnorr (efficient) and Groth16 (compact) protocols based on the number of prime numbers;
[0007] AKS algorithm improvements: Improve efficiency through interval compression and parallel computing;
[0008] Modular design: compatible with traditional RSA and post-quantum encryption algorithms.
[0009] Technical solution details
[0010] Step 1: Candidate prime number generation
[0011] Enter the target number of bits n (such as 2048);
[0012] Output candidate number p∈[2^{n-1},2^{n}), and compress the sampling interval by 30%;
[0013] The parallelized AKS algorithm is used to determine prime numbers.
[0014] Step 2: Dynamic ZKP Verification
[0015] If n≤2048: Call the Schnorr protocol to generate a proof to verify that p is prime and p≡3mod4;
[0016] If n>2048: Call Groth16 to generate compression proof, verification time <1ms.
[0017] Step 3: RSA key generation
[0018] Output a prime number pair (p,q) to the RSA system, satisfying |pq|>2^{n / 2-100}.
[0019] 4. Beneficial effects
[0020] Efficiency comparison: 2048-bit prime number generation time is reduced from 120 seconds to 52 seconds; 4096-bit prime number generation time is reduced from 480 seconds to 210 seconds (test environment: Intel Xeon 3.2GHz, 32GB RAM).
[0021] Security: ZKP verification resists quantum attacks, with a false positive rate of <10^-6;
[0022] Compatibility: Supports OpenSSL, PKCS#11 and other standards. DETAILED DESCRIPTION
[0023] 1. System architecture and module functions
[0024] like Figure 1 As shown in the (system architecture diagram), the system of the present invention is composed of the following core modules:
[0025] 1. Generate module:
[0026] ○Function: Execute the improved AKS algorithm to generate candidate prime numbers, combined with Monte Carlo sampling technology, and randomly select candidate numbers from the compressed pre-screening interval (30% of the original range).
[0027] ○Parameter settings:
[0028] Target number of prime numbers: 1024 to 4096;
[0029] Sampling times: 10^3 times;
[0030] Confidence level ≥ 99.99%.
[0031] ○Output: candidate prime number p.
[0032] 2. Verification module:
[0033] ○ Function: Dynamically select the zero-knowledge proof protocol based on the number of candidate prime numbers:
[0034] When the number of bits is 1024 to 2048: Call the Schnorr protocol to verify the following conditions (see Figure 2 ):
[0035] Prime number attribute (p is a prime number);
[0036] Strong prime condition (p≡3mod4).
[0037] When the number of bits is 2049 to 4096: call Groth16 theorem to generate a compact proof (proof size ≤ 128 bytes, verification time < 1ms).
[0038] ○ Output: Verification result (pass / fail).
[0039] 3. Interface module:
[0040] ○Function: Transmit the verified prime number pair (p,q) to the RSA key generation system through the PKCS#11 standard interface.
[0041] ○ Extended support: Compatible with post-quantum encryption algorithms (such as NTRU and lattice-based algorithms), and supports plug-in protocol replacement (such as switching to the STARK protocol).
[0042] 2. Core algorithm implementation steps
[0043] Step 1: Candidate prime number generation (corresponding to Figure 1 Generate Module)
[0044] 1. Input parameter: target number of bits n (e.g. 2048 bits).
[0045] 2. Pre-screening interval compression:
[0046] ○Original interval: [2^{n-1},2^{n});
[0047] ○Compressed interval: The random sampling range is reduced to 30% of the original range, reducing invalid calculations.
[0048] 3. Parallelize the AKS algorithm:
[0049] ○ Use Fast Modular Reduction (FMRR) to reduce the time complexity from O(n^6) to O(n^3);
[0050] ○Support multi-core CPU or GPU acceleration to improve computing efficiency.
[0051] 4. Output the candidate prime number p.
[0052] Step 2: Dynamic ZKP Verification (corresponding to Figure 2 flow chart)
[0053] 1. Input the candidate prime number p and determine its number of digits:
[0054] If the value is 1024 to 2048 bits: use the Schnorr protocol to generate a zero-knowledge proof.
[0055] If the length is 2049 to 4096 bits: Use Groth16 to generate a compact proof.
[0056] 2. Schnorr protocol implementation details:
[0057] Generate proofs based on elliptic curve parameters (e.g., secp256k1);
[0058] ○ Hash function binding (SHA-256) ensures tamper resistance;
[0059] ○Verification time <1ms.
[0060] 3.Groth16 implementation details:
[0061] ○ Use bilinear pairing to optimize the proof structure;
[0062] ○ Polynomial Commitment is embedded in the verification circuit to reduce the amount of computation.
[0063] 4. Output verification results: If passed, proceed to step 3; if not, return to step 1 and regenerate.
[0064] Step 3: Generate RSA key (corresponding to Figure 4 )
[0065] 1. Generate prime number pairs (p,q):
[0066] ○Additional safety conditions must be met:
[0067] |pq|>2^{n / 2-100} (resistance to Fermat decomposition attack);
[0068] The randomness of the binary representation of p and q is ≥50%.
[0069] 2. Call the PKCS#11 interface:
[0070] Generate a public key (e=65537) and a private key d;
[0071] ○Supports mainstream encryption libraries such as OpenSSL and Bouncy Castle.
[0072] 3. Operation Example (Implementation)
[0073] Example: Generate a 2048-bit RSA key pair
[0074] 1. Input parameters:
[0075] ○Target number of bits n = 2048;
[0076] ○ Pre-screening range: [2^{2047}, 2^{2048}) (30% of the original range after compression).
[0077] 2. Generate candidate prime number p:
[0078] ○ Generate p=0x8F3A... (example value) through the parallel AKS algorithm;
[0079] ○Monte Carlo sampling times: 1000 times, error tolerance ≤ 5%.
[0080] 3. Dynamic ZKP Verification:
[0081] ○ Calling the Schnorr protocol to verify the primality of p and the condition p≡3mod4 takes 0.8ms;
[0082] ○Generation proof size: 64 bytes.
[0083] 4. Generate prime number pairs (p,q):
[0084] q = 0x9B1C... (satisfying |pq| > 2^{1024 - 100});
[0085] 5. Output the key:
[0086] ○ Public key: n = pq = 0x..., e = 65537;
[0087] Private key: d = 0x...
[0088] Total time: 52 seconds (compared to 120 seconds for the traditional method).
[0089] 4. Technical effect verification
[0090] 1. Efficiency comparison (test environment: Intel Xeon 3.2GHz, 32GB RAM):
[0091]
[0092] 2. Security Verification:
[0093] ○ Anti-quantum attack test: Under the simulated Shor algorithm attack, the traditional method takes 10 minutes to crack. Due to the ZKP verification of the present invention, the cracking time is extended to 3 hours;
[0094] ○ False positive rate: Monte Carlo sampling false positive rate <10^-6. BRIEF DESCRIPTION OF THE DRAWINGS
[0095] Figure 1 : The system architecture diagram shows the interaction of generation, verification and interface modules;
[0096] Figure 2 : Dynamic ZKP flow chart details the protocol switching logic;
[0097] Figure 3 :Paillier encryption split modular exponentiation step supports post-quantum extension;
[0098] Figure 4 : Attached figure marks AKS algorithm optimization and ZKP parameter range
[0099] Note: This implementation method completely covers all technical features of the claims, ensuring that those skilled in the art can implement the present invention based on this.
Claims
1. A prime number generation system based on zero-knowledge proof (ZKP) multi-theorem fusion, characterized by: include: ○ Prime number generation module: using the improved AKS algorithm combined with Monte Carlo sampling, from the compressed pre-screening interval [2^{n-1},2^{n}) generates candidate prime numbers, and the interval compression ratio is 30% of the original range; ○ Dynamic ZKP verification module: Dynamically selects the verification protocol based on the number of prime numbers: 1024-2048-bit primes: Use the Schnorr protocol to generate proofs and verify prime properties and strong primality conditions (p≡3mod4). 2049-4096-bit prime numbers: Use Groth16 to generate compact proofs (≤128 bytes), with verification time <1ms. ○RSA interface module: Input the verified prime number pair (p,q) into the RSA key generation system through the PKCS#11 standard.
2. The system according to claim 1, wherein: The confidence level of the Monte Carlo sampling is ≥99.99%, the number of samplings is 10^3 times, and the error tolerance rate is ≤5%.
3. The system according to claim 1, wherein: The proof generation process of the Schnorr protocol includes elliptic curve parameter binding and hash tamper-proofing.
4. The system according to claim 1, wherein: The Groth16 theorem is verified through a bilinear pairing optimization proof structure.
5. The system according to claim 1, wherein: The improvements to the AKS algorithm include fast modulus calculation of polynomial rings (O(n^3)) and parallel computing acceleration.
6. The system according to claim 1, wherein: The RSA interface module supports plug-in extensions of post-quantum encryption algorithms (NTRU, Lattice-based).