Erzeugen prime numbers
Erzeugen primes for cryptographic keys and number theory. Learn sieves, primality testing, and safe prime generation.
- 1
Prime generation methods: Sieve of Eratosthenes (all primes up to N, efficient for small primes), random search (generate random odd number, test primality, repeat — for crypto), Miller-Rabin (probabilistic primality test, fast and accurate). For cryptography, generate 1024-4096 bit primes using random search + Miller-Rabin.
- 2 Primzahl-Generator →
Erzeugen prime numbers. Specify the bit size (e.g., 1024, 2048) for cryptographic primes, or a range for small primes. The tool uses random search with Miller-Rabin testing — the generated primes are probable primes (error probability < 2^-100).
- 3 Primzahl-Prüfer →
Verify the generated number is prime. The checker uses Miller-Rabin with multiple rounds — more rounds increase confidence. For cryptographic use, 40-64 rounds give negligible false-positive probability. For absolute certainty, use the AKS test (deterministic but slow).
Häufige Fragen
- What is a safe prime?
- A prime p where (p-1)/2 is also prime. Safe primes are used in Diffie-Hellman to prevent certain attacks (Pohlig-Hellman). Generating safe primes is slower — generate p, check if (p-1)/2 is prime, repeat. For most applications, regular primes are sufficient; use safe primes for DH group generation.
- How random must crypto primes be?
- Very random. If the prime generation is predictable (e.g., sequential, low entropy seed), an attacker can guess the primes and break the key. Use a CSPRNG for the random search. Avoid primes with special structure (smooth p-1) — these are vulnerable to specialized attacks. RFC 5234 specifies requirements for DSA primes.