GCD for RSA Key Check

Enter two large integers (e.g. RSA moduli or primes) and instantly see their GCD — if it is greater than 1, they share a factor and the key is weak.

Integer A

Integer B

Quick Test Pairs

Enter two integers and click Compute GCD

Supports arbitrarily large numbers (BigInt)

Copied!

Summary

Enter two large integers (e.g. RSA moduli or primes) and instantly see their GCD — if it is greater than 1, they share a factor and the key is weak.

How it works

  1. Enter both integers A and B in the input fields.
  2. Click "Compute GCD" to run the Euclidean algorithm using JavaScript BigInt.
  3. The result panel shows GCD(A, B), the number of algorithm steps, and a security verdict.
  4. If GCD = 1, the numbers are coprime — no shared prime factor.
  5. If GCD > 1, the shared factor is displayed along with a warning.

Use cases

  • Audit a batch of RSA public keys for shared prime factors (ROCA / batch GCD attack).
  • Verify that two RSA moduli generated on the same weak RNG are not related.
  • Educational demo of the Euclidean algorithm on cryptographic-sized numbers.
  • Quick sanity-check before deploying an RSA key pair to production.
  • Detect entropy failures in embedded devices that reuse prime factors.
  • Check whether p and q derived from the same seed share a GCD > 1.

Frequently Asked Questions

Last updated: 2026-07-01 · Reviewed by Nham Vu