Generate Large Prime Factors

Simple Linux commands to generate large prime factors

  1. Generate prime Candidates
    • ssh-keygen -G candidates -b 2048
    • Creates a file called candidates in current directory
  2. Find prime from candidates
    • ssh-keygen -T moduli -f candidates
    • Creates a file called moduli in current directory, taking input from the candidates file
  3. Pick two primes from moduli file
  4. Create a product
    • export BC_LINE_LENGTH=0
    • echo 'obase=16;ibase=16;<prime>*<prime>'|bc
  5. Optionally convert Hex to Decimal
    1. echo 'obase=10; ibase=16; $hexNum' | bc

Other suggestions

  • Generate multiple candidates/moduli files with different bit size and make prime factors out of them for security

Table of Contents
QR Code
QR Code tech:generate_prime_factors (generated for current page)