# Safe Primes and Number Nerdery

## Jeff Marrison

Disclaimer: The views expressed here are solely those of the author, and do not necessarily represent the views of 2 Ton Digital.

## Introduction

In releasing both the public DH parameter service and now the updated Safe Prime API and Database, a decent number of people use our service for their safe prime seed. In addition to being useful as a dhparam tool like the one we have had up for ages, in the new API I added JSON support for no other reason than to visually display these numbers and example Diffie-Hellman exchanges of how they are used in real-world terms. (Haha, I am guilty of being a number nerd no doubt). See the API details on the Safe Prime page if you are interested in pulling any of these for yourself.

When we talk about key lengths and prime number sizes, most people have not bothered to query WolframAlpha for a visual indication of just how large the numbers are. Further, although the Wikipedia article on Diffie-Hellman key exchange shows an example exchange using the modulus 23, not many people in our experience know what a real-world sized exchange looks like in base 10. While this makes for a very long page full of numbers, I have found it makes for great conversation and inspires young minds interested in maths.

All of the primes we generate are almost certainly prime. All of the 6 primes on the static version of this page, as well as all randomly sampled primes we have pulled were certified prime with the ECPP algorithm using Primo. We use an overkill number of Miller-Rabin primality tests on both the safe prime and its Sophie Germain counterpart. Please see the dhtool page for more information about how we generate the primes themselves.

The static version of this page includes a hand-sampled set of numbers per size, but as mentioned before, if you have javascript enabled, these should update dynamically to pick a new random set on each page load from our prime database. Cheers!

# Sample 2048-bit Safe Prime DH params

```Safe Prime p (617 base10 digits):
pretty: 25,800,067,874,133,260,660,345,127,251,227,020,705,188,496,548,274,116,921,985,993,281,967,804,952,257,240,775,824,020,848,001,229,598,175,098,319,282,710,192,845,525,779,715,822,266,921,439,719,962,740,689,815,792,179,289,552,165,093,500,569,732,139,859,156,449,894,441,889,441,354,076,602,361,108,516,361,006,065,046,229,284,963,836,542,104,104,891,102,486,847,219,857,584,215,538,678,231,372,880,855,971,808,838,769,884,267,599,980,835,796,736,677,757,949,174,359,988,755,199,002,755,842,046,077,673,426,953,046,644,694,000,074,704,797,242,058,362,756,844,455,280,559,067,346,551,446,195,890,225,188,830,903,078,346,661,209,619,597,597,756,671,109,943,973,624,946,449,357,010,655,501,482,563,928,303,243,656,236,782,371,921,280,826,026,539,392,037,151,889,122,886,236,682,224,776,441,425,694,641,443,902,512,856,864,507
base10: 25800067874133260660345127251227020705188496548274116921985993281967804952257240775824020848001229598175098319282710192845525779715822266921439719962740689815792179289552165093500569732139859156449894441889441354076602361108516361006065046229284963836542104104891102486847219857584215538678231372880855971808838769884267599980835796736677757949174359988755199002755842046077673426953046644694000074704797242058362756844455280559067346551446195890225188830903078346661209619597597756671109943973624946449357010655501482563928303243656236782371921280826026539392037151889122886236682224776441425694641443902512856864507
base16: 0xcc603b56298c54c737b7bdd033f6f6d2e1b85deae6a0fdb4684c2ea1a3c5ee6d7915d81199862712eecde9c6b42cef3549ccdbe664e22e6fa349e55ea97fbefee47e1c456b1d9c600c772f45179df2a362ca5ded3b2128a59848965400c1b320f33a7e1bba65593dbcbb9f6569b8f9fe1bfa6e26dea0b5b44412142693564728860881c54fce83d7b0c909b3341a11eb801daace3f3d2c5693741aafd57ecc022d64a65d520455814f11a2b2aec40a18ce47d01f372f051e8435fb6d6324b29492b95c1c663033acf5d20e234a3624b8056a7cac078e6abb0a279873f14ae5bf7383bbea67c944cd1eed127b2a64c80292658d9d2f593c493dfd6a1961e096fb

Sophie Germain Prime q (617 base10 digits):
pretty: 12,900,033,937,066,630,330,172,563,625,613,510,352,594,248,274,137,058,460,992,996,640,983,902,476,128,620,387,912,010,424,000,614,799,087,549,159,641,355,096,422,762,889,857,911,133,460,719,859,981,370,344,907,896,089,644,776,082,546,750,284,866,069,929,578,224,947,220,944,720,677,038,301,180,554,258,180,503,032,523,114,642,481,918,271,052,052,445,551,243,423,609,928,792,107,769,339,115,686,440,427,985,904,419,384,942,133,799,990,417,898,368,338,878,974,587,179,994,377,599,501,377,921,023,038,836,713,476,523,322,347,000,037,352,398,621,029,181,378,422,227,640,279,533,673,275,723,097,945,112,594,415,451,539,173,330,604,809,798,798,878,335,554,971,986,812,473,224,678,505,327,750,741,281,964,151,621,828,118,391,185,960,640,413,013,269,696,018,575,944,561,443,118,341,112,388,220,712,847,320,721,951,256,428,432,253
base10: 12900033937066630330172563625613510352594248274137058460992996640983902476128620387912010424000614799087549159641355096422762889857911133460719859981370344907896089644776082546750284866069929578224947220944720677038301180554258180503032523114642481918271052052445551243423609928792107769339115686440427985904419384942133799990417898368338878974587179994377599501377921023038836713476523322347000037352398621029181378422227640279533673275723097945112594415451539173330604809798798878335554971986812473224678505327750741281964151621828118391185960640413013269696018575944561443118341112388220712847320721951256428432253

Generator g:
3
```

# Example 2048-bit DH exchange

```Alice's Secret a = 512 bit random number (154 base10 digits):
pretty: 1,584,798,230,576,126,440,959,818,004,512,461,770,547,633,429,977,999,562,727,323,506,221,580,381,204,318,963,782,100,566,162,773,387,877,504,766,412,974,585,967,295,081,679,124,248,780,857,901,760,336,490
base10: 1584798230576126440959818004512461770547633429977999562727323506221580381204318963782100566162773387877504766412974585967295081679124248780857901760336490
base16: 0x1e42551779589e54882307331ee79e451e920d9bca47c692d1921185e2e3ff7e2a4e846fdbe55909ab3c976f20ee24e838f7c73482df85755bf1c3d30bdb526a

Alice's Public A = g**a mod p (617 base10 digits):
pretty: 11,706,518,816,914,002,122,676,815,182,288,424,037,361,740,496,140,625,393,452,752,353,962,837,584,466,090,015,161,974,102,156,245,191,811,983,868,212,510,861,233,415,275,357,291,783,719,711,584,215,192,805,293,050,658,099,447,692,271,891,908,647,490,706,617,502,982,948,793,950,078,261,760,179,137,506,129,594,905,835,359,274,971,846,630,716,621,641,888,913,782,993,818,611,345,724,388,373,289,964,423,984,693,064,542,096,349,585,150,018,708,244,937,842,671,641,884,027,683,596,115,267,534,749,874,905,740,075,811,482,990,587,541,800,261,421,891,599,145,542,442,790,594,293,593,355,805,513,133,125,915,392,147,599,089,953,937,159,034,429,664,007,742,293,970,366,855,175,563,883,714,236,240,255,543,329,284,590,305,743,748,816,587,029,756,658,689,946,186,559,691,675,676,548,740,344,898,699,447,823,444,437,649,598,428,261
base10: 11706518816914002122676815182288424037361740496140625393452752353962837584466090015161974102156245191811983868212510861233415275357291783719711584215192805293050658099447692271891908647490706617502982948793950078261760179137506129594905835359274971846630716621641888913782993818611345724388373289964423984693064542096349585150018708244937842671641884027683596115267534749874905740075811482990587541800261421891599145542442790594293593355805513133125915392147599089953937159034429664007742293970366855175563883714236240255543329284590305743748816587029756658689946186559691675676548740344898699447823444437649598428261
base16: 0x5cbbc61e29c92234a713b7b078174b3b9a130d78d542603316eb8865841ba41c314b6087678f38d79e3df09f3b05156f059b6f3ac6a3ee56110007f1c5b8a39ac51d6e80ca0435c4916501497a5817c38092c4b751e9b7b35e21f89e7e9f099c60b2b335cea8f1429c7886329ec6d8176163d0ff05815a6002aec1a4eb88a2796f67b05588f93785677c1748d6ae071f58d135550355a7c0ea5c270e582af9a021a2490bb88eaac9389784fed7dbbf151da05c3ea6e3fc9a8f048056d73a17e4ae232ac0f80d26b0838cb1f338d9f5ecebe2b6436e40dfb407e3c9286706a5cb17562e12c9e21fc51d0c447e0d09eb5a53cfc419906da7de2144f0294bfbb465

Bob's Secret b = 512 bit random number (154 base10 digits):
pretty: 2,967,556,634,274,421,523,372,875,717,106,065,110,651,718,792,669,286,918,334,885,733,220,813,782,527,274,052,668,227,702,887,572,179,225,579,573,646,442,454,944,591,378,712,795,693,267,989,357,283,452,407
base10: 2967556634274421523372875717106065110651718792669286918334885733220813782527274052668227702887572179225579573646442454944591378712795693267989357283452407
base16: 0x38a91d5b6fca914bec07d7682a2dc0140a58df5fa4e1cfa38232d28546835c79602a8a30566d3bfc7559b62d30ff60b767309564914eac240d617b95210b25f7

Bob's Public B = g**b mod p (616 base10 digits):
pretty: 9,656,891,112,320,959,490,795,051,007,601,392,123,201,237,724,332,656,440,301,696,573,409,948,246,603,623,824,645,721,819,240,169,014,691,833,035,566,939,519,805,956,248,250,631,610,484,516,286,963,974,840,631,352,087,099,232,083,277,374,595,493,637,835,888,417,892,546,816,111,450,783,133,805,321,658,422,476,291,285,715,188,062,429,348,390,414,519,257,906,853,728,392,720,843,828,005,311,102,800,948,916,033,647,039,236,134,463,382,243,924,047,501,437,114,858,503,344,346,896,227,335,383,275,289,511,732,143,567,851,779,788,307,947,156,261,709,224,031,390,366,316,628,002,663,474,719,140,724,571,352,277,963,675,994,954,343,959,169,580,581,927,963,699,675,054,698,536,495,571,534,351,588,436,573,418,443,734,596,201,163,930,912,353,827,184,394,821,120,384,121,917,101,388,954,537,111,974,616,970,932,728,447,332,360,208
base10: 9656891112320959490795051007601392123201237724332656440301696573409948246603623824645721819240169014691833035566939519805956248250631610484516286963974840631352087099232083277374595493637835888417892546816111450783133805321658422476291285715188062429348390414519257906853728392720843828005311102800948916033647039236134463382243924047501437114858503344346896227335383275289511732143567851779788307947156261709224031390366316628002663474719140724571352277963675994954343959169580581927963699675054698536495571534351588436573418443734596201163930912353827184394821120384121917101388954537111974616970932728447332360208

Shared Secret s for Alice = B**a mod p:
Shared Secret s for Bob = A**b mod p (616 base10 digits):
pretty: 4,876,235,860,564,517,525,510,790,049,775,292,303,382,542,464,380,571,984,994,095,462,234,645,544,836,162,168,900,342,026,950,635,035,760,625,248,367,277,099,854,921,937,525,903,963,455,049,650,023,473,012,968,991,202,178,279,971,729,565,480,255,839,834,674,539,535,269,180,357,802,366,340,499,339,619,209,383,593,970,130,920,620,851,398,902,839,771,459,340,725,195,211,492,318,805,823,333,696,193,428,554,708,541,395,233,448,195,072,020,377,093,094,533,223,083,729,714,539,667,469,795,042,700,191,846,637,602,723,501,803,756,795,582,093,954,876,740,212,097,090,253,961,672,462,649,623,351,003,968,240,006,447,879,124,876,174,096,432,520,510,303,201,576,074,257,712,390,015,597,572,624,918,551,327,596,421,704,451,621,152,790,147,435,416,311,791,769,696,655,930,711,544,281,776,406,721,880,442,963,022,456,240,175,677,234
base10: 4876235860564517525510790049775292303382542464380571984994095462234645544836162168900342026950635035760625248367277099854921937525903963455049650023473012968991202178279971729565480255839834674539535269180357802366340499339619209383593970130920620851398902839771459340725195211492318805823333696193428554708541395233448195072020377093094533223083729714539667469795042700191846637602723501803756795582093954876740212097090253961672462649623351003968240006447879124876174096432520510303201576074257712390015597572624918551327596421704451621152790147435416311791769696655930711544281776406721880442963022456240175677234
```

# Sample 4096-bit Safe Prime DH params

```Safe Prime p (1233 base10 digits):
pretty: 899,630,774,163,945,537,207,555,407,001,180,676,391,021,689,086,636,320,791,661,992,339,784,274,865,436,963,961,098,369,491,502,743,905,240,506,547,704,662,591,746,242,453,097,167,842,649,680,016,302,702,598,748,244,885,713,660,256,538,647,667,789,378,791,682,078,221,576,252,824,073,286,770,100,014,141,172,215,226,314,272,382,718,310,093,469,781,245,545,548,868,073,006,534,040,475,314,488,032,896,712,106,320,324,211,689,010,698,652,347,652,301,115,524,943,337,240,248,061,638,904,266,052,941,705,225,635,467,996,851,361,819,937,151,802,512,110,606,843,189,148,393,481,881,281,012,238,843,869,093,701,249,510,119,542,990,383,754,750,717,827,039,723,823,416,976,593,659,929,156,757,611,636,360,566,828,304,480,779,143,698,804,496,408,487,088,139,744,741,053,440,826,450,997,441,882,800,317,032,479,508,693,153,357,017,544,525,634,642,640,303,018,023,032,103,210,109,175,945,473,125,640,838,771,912,188,110,707,765,262,784,339,609,816,216,812,134,257,851,441,200,172,309,824,570,032,709,058,123,223,578,857,818,792,844,891,147,310,361,123,877,614,656,228,888,069,048,278,286,474,538,846,194,583,292,665,988,956,497,978,462,879,804,300,553,798,364,522,519,844,019,134,168,340,980,737,968,776,917,793,608,525,005,693,715,221,389,108,631,602,674,574,126,952,379,281,816,950,169,477,105,762,704,202,195,903,596,901,655,344,095,551,517,433,580,861,252,775,933,375,736,549,603,897,267,564,507,424,780,541,142,141,574,783,025,016,561,803,409,558,836,820,943,780,050,775,013,292,353,719,034,477,759,060,160,243,820,781,481,402,984,315,782,928,702,268,643,631,514,517,954,875,066,737,993,785,867,944,129,184,878,704,253,043,679,394,560,481,657,545,447
base10: 899630774163945537207555407001180676391021689086636320791661992339784274865436963961098369491502743905240506547704662591746242453097167842649680016302702598748244885713660256538647667789378791682078221576252824073286770100014141172215226314272382718310093469781245545548868073006534040475314488032896712106320324211689010698652347652301115524943337240248061638904266052941705225635467996851361819937151802512110606843189148393481881281012238843869093701249510119542990383754750717827039723823416976593659929156757611636360566828304480779143698804496408487088139744741053440826450997441882800317032479508693153357017544525634642640303018023032103210109175945473125640838771912188110707765262784339609816216812134257851441200172309824570032709058123223578857818792844891147310361123877614656228888069048278286474538846194583292665988956497978462879804300553798364522519844019134168340980737968776917793608525005693715221389108631602674574126952379281816950169477105762704202195903596901655344095551517433580861252775933375736549603897267564507424780541142141574783025016561803409558836820943780050775013292353719034477759060160243820781481402984315782928702268643631514517954875066737993785867944129184878704253043679394560481657545447

Sophie Germain Prime q (1233 base10 digits):
pretty: 449,815,387,081,972,768,603,777,703,500,590,338,195,510,844,543,318,160,395,830,996,169,892,137,432,718,481,980,549,184,745,751,371,952,620,253,273,852,331,295,873,121,226,548,583,921,324,840,008,151,351,299,374,122,442,856,830,128,269,323,833,894,689,395,841,039,110,788,126,412,036,643,385,050,007,070,586,107,613,157,136,191,359,155,046,734,890,622,772,774,434,036,503,267,020,237,657,244,016,448,356,053,160,162,105,844,505,349,326,173,826,150,557,762,471,668,620,124,030,819,452,133,026,470,852,612,817,733,998,425,680,909,968,575,901,256,055,303,421,594,574,196,740,940,640,506,119,421,934,546,850,624,755,059,771,495,191,877,375,358,913,519,861,911,708,488,296,829,964,578,378,805,818,180,283,414,152,240,389,571,849,402,248,204,243,544,069,872,370,526,720,413,225,498,720,941,400,158,516,239,754,346,576,678,508,772,262,817,321,320,151,509,011,516,051,605,054,587,972,736,562,820,419,385,956,094,055,353,882,631,392,169,804,908,108,406,067,128,925,720,600,086,154,912,285,016,354,529,061,611,789,428,909,396,422,445,573,655,180,561,938,807,328,114,444,034,524,139,143,237,269,423,097,291,646,332,994,478,248,989,231,439,902,150,276,899,182,261,259,922,009,567,084,170,490,368,984,388,458,896,804,262,502,846,857,610,694,554,315,801,337,287,063,476,189,640,908,475,084,738,552,881,352,101,097,951,798,450,827,672,047,775,758,716,790,430,626,387,966,687,868,274,801,948,633,782,253,712,390,270,571,070,787,391,512,508,280,901,704,779,418,410,471,890,025,387,506,646,176,859,517,238,879,530,080,121,910,390,740,701,492,157,891,464,351,134,321,815,757,258,977,437,533,368,996,892,933,972,064,592,439,352,126,521,839,697,280,240,828,772,723
base10: 449815387081972768603777703500590338195510844543318160395830996169892137432718481980549184745751371952620253273852331295873121226548583921324840008151351299374122442856830128269323833894689395841039110788126412036643385050007070586107613157136191359155046734890622772774434036503267020237657244016448356053160162105844505349326173826150557762471668620124030819452133026470852612817733998425680909968575901256055303421594574196740940640506119421934546850624755059771495191877375358913519861911708488296829964578378805818180283414152240389571849402248204243544069872370526720413225498720941400158516239754346576678508772262817321320151509011516051605054587972736562820419385956094055353882631392169804908108406067128925720600086154912285016354529061611789428909396422445573655180561938807328114444034524139143237269423097291646332994478248989231439902150276899182261259922009567084170490368984388458896804262502846857610694554315801337287063476189640908475084738552881352101097951798450827672047775758716790430626387966687868274801948633782253712390270571070787391512508280901704779418410471890025387506646176859517238879530080121910390740701492157891464351134321815757258977437533368996892933972064592439352126521839697280240828772723

Generator g:
2
```

# Example 4096-bit DH exchange

```Alice's Secret a = 512 bit random number (155 base10 digits):
pretty: 13,203,194,625,670,185,480,128,435,655,453,226,638,207,975,484,527,843,468,542,307,982,129,013,936,393,155,756,177,038,030,103,894,113,431,191,487,717,375,652,131,633,094,710,530,853,802,409,502,851,980,299
base10: 13203194625670185480128435655453226638207975484527843468542307982129013936393155756177038030103894113431191487717375652131633094710530853802409502851980299
base16: 0xfc17def9fea248d8e950a87d7ef4c8d9aa408f0ce0cc724a5926b50ee0ea09787c71ecf92a5e62ef9274399c81bf3f90db5c172509fd93246c1e5974a357dc0b

Alice's Public A = g**a mod p (1233 base10 digits):
pretty: 618,011,160,455,794,009,918,321,745,210,158,030,875,185,488,574,196,327,774,424,129,032,681,645,048,375,509,365,907,109,092,536,701,899,728,528,275,214,688,236,274,627,630,333,091,926,779,679,681,052,998,217,785,834,474,333,919,863,537,817,182,303,565,568,289,777,068,027,473,005,469,137,684,326,949,495,932,608,766,675,761,395,659,349,101,140,819,875,973,921,403,929,177,088,718,682,325,085,662,589,718,750,327,305,578,745,757,288,326,966,366,375,830,999,261,194,844,127,837,578,010,797,952,116,676,536,977,115,180,498,279,783,668,655,484,084,241,789,521,105,617,337,957,165,136,483,765,836,863,974,220,582,244,575,514,166,240,680,862,635,059,413,215,430,344,785,312,509,907,553,877,389,770,310,785,149,137,456,214,671,964,170,636,308,903,259,608,814,109,274,771,864,887,255,691,112,823,174,525,829,625,024,159,301,957,515,164,633,968,562,313,740,255,437,300,341,216,551,644,893,366,474,673,581,567,386,447,998,848,791,363,145,060,776,995,372,079,323,168,444,151,371,894,602,245,717,672,512,377,460,472,501,221,443,089,987,252,902,602,118,645,591,318,799,058,764,142,063,214,454,750,846,619,691,273,563,165,415,038,755,671,221,484,285,925,621,086,007,530,407,061,645,633,037,182,687,486,450,744,487,782,848,635,541,062,980,824,246,625,860,412,260,470,424,040,607,052,923,817,407,433,267,217,031,963,984,265,022,233,920,724,022,367,147,761,660,049,690,915,807,156,307,941,266,867,416,399,481,452,161,535,612,682,685,510,992,358,751,062,782,215,696,755,942,698,638,373,746,430,346,329,804,745,522,142,526,887,926,125,075,411,678,008,849,760,944,468,572,142,073,340,283,825,678,852,384,907,610,422,476,764,025,454,363,750,630,977,298,210,801,215
base10: 618011160455794009918321745210158030875185488574196327774424129032681645048375509365907109092536701899728528275214688236274627630333091926779679681052998217785834474333919863537817182303565568289777068027473005469137684326949495932608766675761395659349101140819875973921403929177088718682325085662589718750327305578745757288326966366375830999261194844127837578010797952116676536977115180498279783668655484084241789521105617337957165136483765836863974220582244575514166240680862635059413215430344785312509907553877389770310785149137456214671964170636308903259608814109274771864887255691112823174525829625024159301957515164633968562313740255437300341216551644893366474673581567386447998848791363145060776995372079323168444151371894602245717672512377460472501221443089987252902602118645591318799058764142063214454750846619691273563165415038755671221484285925621086007530407061645633037182687486450744487782848635541062980824246625860412260470424040607052923817407433267217031963984265022233920724022367147761660049690915807156307941266867416399481452161535612682685510992358751062782215696755942698638373746430346329804745522142526887926125075411678008849760944468572142073340283825678852384907610422476764025454363750630977298210801215

Bob's Secret b = 512 bit random number (155 base10 digits):
pretty: 12,655,010,618,029,198,203,883,123,151,862,853,950,970,351,351,547,612,231,194,864,947,753,688,834,631,562,624,986,915,277,870,354,790,956,250,618,161,433,694,426,139,141,385,070,756,808,110,398,462,618,316
base10: 12655010618029198203883123151862853950970351351547612231194864947753688834631562624986915277870354790956250618161433694426139141385070756808110398462618316

Bob's Public B = g**b mod p (1232 base10 digits):
pretty: 83,456,007,696,073,721,335,398,285,773,890,106,989,869,119,804,148,503,975,733,610,515,724,588,925,630,370,744,607,516,030,881,781,001,749,763,064,802,524,643,825,672,597,159,978,162,165,831,913,568,204,951,227,703,431,121,239,254,830,342,602,763,343,574,836,673,159,572,452,900,162,179,063,542,557,187,651,573,933,205,790,924,832,563,145,129,146,689,250,827,067,470,793,361,040,369,925,909,319,494,174,064,074,366,931,225,747,460,099,337,336,292,737,537,816,130,393,553,446,052,553,861,795,656,414,251,126,452,648,023,616,879,689,324,041,125,408,306,985,277,509,246,344,983,479,947,676,081,004,191,440,687,604,136,825,838,012,628,452,090,282,159,098,483,324,307,621,503,090,032,583,941,014,092,883,495,762,191,036,570,572,261,908,967,299,267,590,873,120,873,971,166,990,922,914,032,621,800,760,673,469,414,341,852,517,411,961,400,973,850,040,542,571,913,818,710,335,567,211,138,499,546,214,338,720,051,942,867,257,959,943,220,395,688,694,126,445,857,465,194,538,601,916,807,030,450,057,976,263,400,762,871,052,789,852,412,033,048,186,850,022,950,281,031,527,366,375,979,319,418,490,514,886,251,682,099,055,453,409,034,010,534,608,799,050,896,662,351,637,725,714,867,489,464,998,646,867,919,696,429,391,774,444,792,018,021,465,188,253,866,735,072,781,459,840,913,716,048,316,896,976,476,855,893,272,022,741,237,513,748,315,914,559,800,639,426,617,276,003,918,785,451,945,592,534,850,749,081,743,245,176,255,979,238,646,155,156,118,124,552,180,791,484,171,656,124,585,451,829,356,007,291,281,910,524,491,315,053,894,500,349,346,875,889,580,182,966,769,801,569,101,261,882,115,490,295,856,393,046,973,447,787,359,311,005,934,508,050,460,352,480
base10: 83456007696073721335398285773890106989869119804148503975733610515724588925630370744607516030881781001749763064802524643825672597159978162165831913568204951227703431121239254830342602763343574836673159572452900162179063542557187651573933205790924832563145129146689250827067470793361040369925909319494174064074366931225747460099337336292737537816130393553446052553861795656414251126452648023616879689324041125408306985277509246344983479947676081004191440687604136825838012628452090282159098483324307621503090032583941014092883495762191036570572261908967299267590873120873971166990922914032621800760673469414341852517411961400973850040542571913818710335567211138499546214338720051942867257959943220395688694126445857465194538601916807030450057976263400762871052789852412033048186850022950281031527366375979319418490514886251682099055453409034010534608799050896662351637725714867489464998646867919696429391774444792018021465188253866735072781459840913716048316896976476855893272022741237513748315914559800639426617276003918785451945592534850749081743245176255979238646155156118124552180791484171656124585451829356007291281910524491315053894500349346875889580182966769801569101261882115490295856393046973447787359311005934508050460352480

Shared Secret s for Alice = B**a mod p:
Shared Secret s for Bob = A**b mod p (1233 base10 digits):
pretty: 893,169,552,902,474,950,329,690,178,817,777,929,717,592,220,738,063,917,315,910,451,757,655,390,738,936,990,062,390,558,847,003,354,439,200,947,371,947,745,552,871,917,864,045,815,599,918,854,437,908,611,406,876,744,489,315,171,313,559,663,016,423,927,804,113,165,332,406,895,041,205,544,312,935,213,461,059,476,482,463,744,416,427,830,809,568,436,204,138,332,644,781,412,716,944,339,201,723,813,319,745,580,632,820,293,024,674,775,108,108,379,556,969,217,167,719,353,390,686,441,387,873,659,960,052,953,184,131,541,485,259,420,489,809,104,703,075,959,425,896,863,502,375,984,835,003,229,322,572,803,540,568,603,350,147,194,612,462,763,452,691,222,725,182,351,423,841,973,640,501,538,293,922,000,777,804,580,873,743,425,263,679,968,538,285,307,992,665,283,860,250,514,889,591,845,254,558,909,291,186,378,720,448,197,006,227,625,176,964,205,848,529,800,512,790,077,991,629,583,294,937,030,814,708,014,449,720,825,586,174,410,912,897,546,364,246,244,079,156,707,458,274,605,125,010,659,015,307,501,457,248,901,916,263,564,368,405,025,214,054,399,483,926,338,269,071,528,142,141,283,193,577,135,722,564,286,199,056,749,651,004,433,949,833,615,405,910,074,314,259,656,112,042,312,903,953,310,079,519,577,767,969,325,611,021,205,312,802,177,041,179,402,505,394,719,000,221,214,219,962,591,879,758,626,583,277,167,148,505,030,167,576,369,902,055,384,428,127,482,931,425,307,445,075,418,761,739,656,740,667,262,869,803,570,693,973,751,493,431,612,388,011,244,399,096,497,510,403,738,264,848,597,675,413,660,159,360,085,371,176,217,817,945,955,316,221,452,990,632,458,729,092,233,220,584,044,982,408,688,091,119,328,102,107,197,340,066,574,218,793,880
base10: 893169552902474950329690178817777929717592220738063917315910451757655390738936990062390558847003354439200947371947745552871917864045815599918854437908611406876744489315171313559663016423927804113165332406895041205544312935213461059476482463744416427830809568436204138332644781412716944339201723813319745580632820293024674775108108379556969217167719353390686441387873659960052953184131541485259420489809104703075959425896863502375984835003229322572803540568603350147194612462763452691222725182351423841973640501538293922000777804580873743425263679968538285307992665283860250514889591845254558909291186378720448197006227625176964205848529800512790077991629583294937030814708014449720825586174410912897546364246244079156707458274605125010659015307501457248901916263564368405025214054399483926338269071528142141283193577135722564286199056749651004433949833615405910074314259656112042312903953310079519577767969325611021205312802177041179402505394719000221214219962591879758626583277167148505030167576369902055384428127482931425307445075418761739656740667262869803570693973751493431612388011244399096497510403738264848597675413660159360085371176217817945955316221452990632458729092233220584044982408688091119328102107197340066574218793880
```

# Sample 8192-bit Safe Prime DH params

```Safe Prime p (2466 base10 digits):
pretty: 733,700,403,882,364,243,355,879,068,623,828,071,703,490,431,593,186,209,607,801,992,015,411,553,979,959,990,934,679,874,921,409,380,405,700,603,661,764,426,346,988,050,985,635,081,114,068,597,076,921,568,185,340,734,491,268,341,731,757,625,498,451,214,993,183,440,074,185,157,890,585,079,861,324,759,364,842,470,390,017,978,312,590,221,868,178,099,052,819,426,881,127,254,668,559,508,326,531,087,507,412,070,839,466,909,135,595,629,256,225,506,677,796,359,893,579,638,368,970,626,782,393,702,673,502,788,127,848,641,095,096,142,691,287,009,389,951,272,290,286,748,922,330,664,144,081,948,812,499,264,671,950,390,742,593,853,798,898,185,347,731,913,897,926,238,419,441,726,902,604,060,721,613,283,224,726,524,035,836,124,820,156,272,811,642,929,811,423,795,868,617,294,092,524,783,439,675,299,348,312,095,788,763,221,415,331,113,035,583,739,065,078,132,609,091,393,199,065,291,772,055,507,019,801,643,596,430,651,113,456,607,107,466,708,756,778,468,312,461,831,922,271,395,065,649,010,788,783,976,685,534,688,558,577,289,008,129,593,010,621,115,481,664,238,231,406,547,989,444,142,906,185,535,301,177,658,920,766,907,439,123,441,480,805,502,048,076,659,017,759,073,991,440,682,623,126,794,450,803,140,060,812,348,614,175,140,446,254,634,206,632,986,530,675,528,644,908,928,240,101,058,069,482,982,716,555,164,352,300,113,886,553,867,466,942,259,475,508,808,966,697,012,045,849,365,360,233,151,360,183,861,282,910,398,649,852,066,183,843,420,380,296,479,844,480,374,973,941,412,626,094,167,466,990,569,788,922,851,910,553,134,713,606,671,290,759,289,622,294,124,777,516,059,238,210,811,078,785,212,391,506,552,735,945,745,691,299,372,160,583,243,189,925,083,586,140,833,539,191,020,889,394,585,771,570,342,055,957,481,476,565,536,085,403,957,235,745,609,369,633,342,980,056,391,224,422,144,899,138,104,489,565,246,920,276,522,909,356,751,103,115,196,028,894,519,908,633,419,206,027,304,523,102,431,075,868,778,851,335,048,314,368,710,387,977,230,829,180,819,540,746,373,655,755,398,277,515,471,382,565,904,941,587,547,658,589,771,419,434,742,190,502,511,806,461,528,270,056,269,423,195,975,575,282,588,227,641,232,859,253,538,161,430,684,741,759,743,594,706,288,103,984,460,493,888,832,956,476,635,375,352,388,360,078,943,348,053,130,883,269,455,855,029,202,288,759,801,527,677,251,105,472,563,561,973,990,274,106,362,364,629,196,507,234,557,605,897,865,163,098,050,520,325,876,217,487,366,304,263,849,508,446,784,008,652,857,273,030,260,498,923,489,180,939,231,102,007,602,118,080,029,725,981,602,163,764,934,396,753,572,251,865,437,189,405,963,329,677,105,239,343,301,337,533,572,997,685,844,429,717,065,090,095,942,464,602,669,467,645,049,448,130,496,830,208,346,113,238,800,699,014,029,968,050,304,978,781,222,700,650,120,206,684,948,814,480,084,029,169,724,186,133,038,200,868,166,783,926,497,594,549,496,659,367,331,694,261,789,208,620,310,241,109,375,499,140,267,106,407,715,725,603,890,682,862,912,424,105,708,554,894,479,776,392,126,923,148,211,978,520,396,471,456,455,713,751,142,870,099,791,068,376,816,144,456,591,178,418,248,617,973,341,578,979,668,409,806,770,660,677,919,286,486,761,115,718,832,420,780,883,598,741,234,727,256,148,135,803,956,647,704,625,203,645,840,985,333,913,356,265,165,415,457,437,799,799,964,018,737,574,379,062,183,896,411,075,325,225,173,310,140,347
base10: 733700403882364243355879068623828071703490431593186209607801992015411553979959990934679874921409380405700603661764426346988050985635081114068597076921568185340734491268341731757625498451214993183440074185157890585079861324759364842470390017978312590221868178099052819426881127254668559508326531087507412070839466909135595629256225506677796359893579638368970626782393702673502788127848641095096142691287009389951272290286748922330664144081948812499264671950390742593853798898185347731913897926238419441726902604060721613283224726524035836124820156272811642929811423795868617294092524783439675299348312095788763221415331113035583739065078132609091393199065291772055507019801643596430651113456607107466708756778468312461831922271395065649010788783976685534688558577289008129593010621115481664238231406547989444142906185535301177658920766907439123441480805502048076659017759073991440682623126794450803140060812348614175140446254634206632986530675528644908928240101058069482982716555164352300113886553867466942259475508808966697012045849365360233151360183861282910398649852066183843420380296479844480374973941412626094167466990569788922851910553134713606671290759289622294124777516059238210811078785212391506552735945745691299372160583243189925083586140833539191020889394585771570342055957481476565536085403957235745609369633342980056391224422144899138104489565246920276522909356751103115196028894519908633419206027304523102431075868778851335048314368710387977230829180819540746373655755398277515471382565904941587547658589771419434742190502511806461528270056269423195975575282588227641232859253538161430684741759743594706288103984460493888832956476635375352388360078943348053130883269455855029202288759801527677251105472563561973990274106362364629196507234557605897865163098050520325876217487366304263849508446784008652857273030260498923489180939231102007602118080029725981602163764934396753572251865437189405963329677105239343301337533572997685844429717065090095942464602669467645049448130496830208346113238800699014029968050304978781222700650120206684948814480084029169724186133038200868166783926497594549496659367331694261789208620310241109375499140267106407715725603890682862912424105708554894479776392126923148211978520396471456455713751142870099791068376816144456591178418248617973341578979668409806770660677919286486761115718832420780883598741234727256148135803956647704625203645840985333913356265165415457437799799964018737574379062183896411075325225173310140347

Sophie Germain Prime q (2466 base10 digits):
pretty: 366,850,201,941,182,121,677,939,534,311,914,035,851,745,215,796,593,104,803,900,996,007,705,776,989,979,995,467,339,937,460,704,690,202,850,301,830,882,213,173,494,025,492,817,540,557,034,298,538,460,784,092,670,367,245,634,170,865,878,812,749,225,607,496,591,720,037,092,578,945,292,539,930,662,379,682,421,235,195,008,989,156,295,110,934,089,049,526,409,713,440,563,627,334,279,754,163,265,543,753,706,035,419,733,454,567,797,814,628,112,753,338,898,179,946,789,819,184,485,313,391,196,851,336,751,394,063,924,320,547,548,071,345,643,504,694,975,636,145,143,374,461,165,332,072,040,974,406,249,632,335,975,195,371,296,926,899,449,092,673,865,956,948,963,119,209,720,863,451,302,030,360,806,641,612,363,262,017,918,062,410,078,136,405,821,464,905,711,897,934,308,647,046,262,391,719,837,649,674,156,047,894,381,610,707,665,556,517,791,869,532,539,066,304,545,696,599,532,645,886,027,753,509,900,821,798,215,325,556,728,303,553,733,354,378,389,234,156,230,915,961,135,697,532,824,505,394,391,988,342,767,344,279,288,644,504,064,796,505,310,557,740,832,119,115,703,273,994,722,071,453,092,767,650,588,829,460,383,453,719,561,720,740,402,751,024,038,329,508,879,536,995,720,341,311,563,397,225,401,570,030,406,174,307,087,570,223,127,317,103,316,493,265,337,764,322,454,464,120,050,529,034,741,491,358,277,582,176,150,056,943,276,933,733,471,129,737,754,404,483,348,506,022,924,682,680,116,575,680,091,930,641,455,199,324,926,033,091,921,710,190,148,239,922,240,187,486,970,706,313,047,083,733,495,284,894,461,425,955,276,567,356,803,335,645,379,644,811,147,062,388,758,029,619,105,405,539,392,606,195,753,276,367,972,872,845,649,686,080,291,621,594,962,541,793,070,416,769,595,510,444,697,292,885,785,171,027,978,740,738,282,768,042,701,978,617,872,804,684,816,671,490,028,195,612,211,072,449,569,052,244,782,623,460,138,261,454,678,375,551,557,598,014,447,259,954,316,709,603,013,652,261,551,215,537,934,389,425,667,524,157,184,355,193,988,615,414,590,409,770,373,186,827,877,699,138,757,735,691,282,952,470,793,773,829,294,885,709,717,371,095,251,255,903,230,764,135,028,134,711,597,987,787,641,294,113,820,616,429,626,769,080,715,342,370,879,871,797,353,144,051,992,230,246,944,416,478,238,317,687,676,194,180,039,471,674,026,565,441,634,727,927,514,601,144,379,900,763,838,625,552,736,281,780,986,995,137,053,181,182,314,598,253,617,278,802,948,932,581,549,025,260,162,938,108,743,683,152,131,924,754,223,392,004,326,428,636,515,130,249,461,744,590,469,615,551,003,801,059,040,014,862,990,801,081,882,467,198,376,786,125,932,718,594,702,981,664,838,552,619,671,650,668,766,786,498,842,922,214,858,532,545,047,971,232,301,334,733,822,524,724,065,248,415,104,173,056,619,400,349,507,014,984,025,152,489,390,611,350,325,060,103,342,474,407,240,042,014,584,862,093,066,519,100,434,083,391,963,248,797,274,748,329,683,665,847,130,894,604,310,155,120,554,687,749,570,133,553,203,857,862,801,945,341,431,456,212,052,854,277,447,239,888,196,063,461,574,105,989,260,198,235,728,227,856,875,571,435,049,895,534,188,408,072,228,295,589,209,124,308,986,670,789,489,834,204,903,385,330,338,959,643,243,380,557,859,416,210,390,441,799,370,617,363,628,074,067,901,978,323,852,312,601,822,920,492,666,956,678,132,582,707,728,718,899,899,982,009,368,787,189,531,091,948,205,537,662,612,586,655,070,173
base10: 366850201941182121677939534311914035851745215796593104803900996007705776989979995467339937460704690202850301830882213173494025492817540557034298538460784092670367245634170865878812749225607496591720037092578945292539930662379682421235195008989156295110934089049526409713440563627334279754163265543753706035419733454567797814628112753338898179946789819184485313391196851336751394063924320547548071345643504694975636145143374461165332072040974406249632335975195371296926899449092673865956948963119209720863451302030360806641612363262017918062410078136405821464905711897934308647046262391719837649674156047894381610707665556517791869532539066304545696599532645886027753509900821798215325556728303553733354378389234156230915961135697532824505394391988342767344279288644504064796505310557740832119115703273994722071453092767650588829460383453719561720740402751024038329508879536995720341311563397225401570030406174307087570223127317103316493265337764322454464120050529034741491358277582176150056943276933733471129737754404483348506022924682680116575680091930641455199324926033091921710190148239922240187486970706313047083733495284894461425955276567356803335645379644811147062388758029619105405539392606195753276367972872845649686080291621594962541793070416769595510444697292885785171027978740738282768042701978617872804684816671490028195612211072449569052244782623460138261454678375551557598014447259954316709603013652261551215537934389425667524157184355193988615414590409770373186827877699138757735691282952470793773829294885709717371095251255903230764135028134711597987787641294113820616429626769080715342370879871797353144051992230246944416478238317687676194180039471674026565441634727927514601144379900763838625552736281780986995137053181182314598253617278802948932581549025260162938108743683152131924754223392004326428636515130249461744590469615551003801059040014862990801081882467198376786125932718594702981664838552619671650668766786498842922214858532545047971232301334733822524724065248415104173056619400349507014984025152489390611350325060103342474407240042014584862093066519100434083391963248797274748329683665847130894604310155120554687749570133553203857862801945341431456212052854277447239888196063461574105989260198235728227856875571435049895534188408072228295589209124308986670789489834204903385330338959643243380557859416210390441799370617363628074067901978323852312601822920492666956678132582707728718899899982009368787189531091948205537662612586655070173

Generator g:
3
```

# Example 8192-bit DH exchange

```Alice's Secret a = 512 bit random number (155 base10 digits):
pretty: 11,103,899,175,180,269,211,112,183,496,210,505,303,440,378,535,611,896,832,996,020,197,570,904,214,106,344,604,022,603,288,934,759,663,731,899,913,331,129,630,720,578,746,322,820,639,582,180,246,823,009,736
base10: 11103899175180269211112183496210505303440378535611896832996020197570904214106344604022603288934759663731899913331129630720578746322820639582180246823009736

Alice's Public A = g**a mod p (2466 base10 digits):
pretty: 137,499,453,732,598,203,485,722,724,856,533,657,630,490,810,781,393,873,288,602,709,715,597,263,432,242,070,425,169,089,102,634,007,616,558,832,211,207,871,368,018,914,416,943,328,095,111,645,931,767,357,277,922,846,937,445,838,326,067,899,899,470,139,135,189,877,795,470,499,597,810,396,293,660,903,729,209,042,915,597,984,698,766,678,022,866,410,077,257,631,463,330,347,618,100,380,541,121,618,850,013,107,876,676,637,173,675,394,957,941,593,324,008,603,807,232,812,227,419,669,562,031,944,902,326,149,299,979,819,812,260,907,619,069,080,125,632,453,073,341,946,147,582,814,108,453,933,018,229,710,711,536,877,858,513,512,299,921,778,503,861,103,707,535,367,846,350,817,541,945,791,186,242,264,717,105,450,032,015,121,228,883,311,310,554,307,642,616,992,497,302,908,694,717,592,433,141,297,144,432,050,368,735,795,242,641,458,340,179,574,570,677,363,094,613,194,407,659,029,479,144,680,817,795,360,430,138,274,949,852,590,078,525,956,271,272,097,617,504,628,863,359,082,722,165,988,051,428,984,350,284,590,945,634,257,023,992,112,109,603,037,913,743,881,093,449,074,739,596,518,025,367,431,357,728,010,078,740,547,844,427,806,945,121,817,630,026,106,069,016,395,628,443,335,874,134,782,223,303,836,066,466,169,610,185,611,500,914,573,834,453,767,768,700,836,697,312,298,170,873,610,903,296,071,503,436,737,775,921,179,256,883,399,734,879,952,729,442,650,214,051,716,136,162,200,565,973,531,954,800,456,343,630,305,569,794,075,157,594,061,975,830,241,309,175,110,342,403,848,770,459,253,822,108,620,055,847,537,863,112,088,953,128,637,896,629,672,657,973,454,415,069,780,665,891,387,271,359,676,420,696,094,880,725,186,108,618,297,986,550,327,395,638,179,845,946,378,371,811,775,850,249,289,852,460,431,576,998,607,184,804,764,865,455,013,595,954,142,610,967,661,806,410,362,224,594,614,800,402,524,713,334,562,398,344,216,220,581,763,873,682,384,606,166,610,604,087,656,154,832,140,923,257,965,683,768,548,028,426,257,913,893,938,075,218,051,784,056,598,869,906,431,914,676,951,171,366,763,803,312,262,722,115,100,832,954,533,306,894,248,256,469,990,901,257,248,810,156,536,808,436,047,935,297,348,759,162,789,618,289,556,994,856,258,007,070,748,274,613,561,558,988,878,973,286,485,214,901,474,312,469,472,851,917,293,326,915,087,133,466,910,661,065,483,827,540,350,325,735,017,648,347,645,483,358,455,553,932,098,063,886,086,089,832,918,391,816,577,731,474,146,242,897,081,650,327,342,629,517,247,329,512,555,799,718,613,152,621,351,015,780,248,414,663,836,212,772,350,248,797,416,726,557,930,308,465,349,936,931,637,914,677,470,247,117,736,671,011,323,370,094,555,428,428,003,694,896,986,812,165,443,724,331,662,841,353,222,117,709,106,536,768,632,436,807,694,114,348,998,425,092,314,975,151,514,349,902,761,822,641,392,758,958,228,200,580,418,449,051,260,129,472,760,424,748,785,116,212,617,553,832,462,993,604,380,017,155,996,498,328,159,332,602,314,656,558,068,420,231,439,621,189,533,513,479,647,688,540,985,812,602,871,732,045,710,938,561,302,942,032,005,728,847,351,542,772,286,352,401,345,746,248,868,174,486,971,824,954,342,522,014,596,143,265,833,726,781,848,858,981,404,642,172,075,323,751,892,847,438,407,062,717,678,257,192,175,539,339,295,868,153,593,811,648,146,623,562,313,220,546,978,665,451,442,286,522,711,883,592,593,546,980,382,891,314,918,154,277,229,422,912,908
base10: 137499453732598203485722724856533657630490810781393873288602709715597263432242070425169089102634007616558832211207871368018914416943328095111645931767357277922846937445838326067899899470139135189877795470499597810396293660903729209042915597984698766678022866410077257631463330347618100380541121618850013107876676637173675394957941593324008603807232812227419669562031944902326149299979819812260907619069080125632453073341946147582814108453933018229710711536877858513512299921778503861103707535367846350817541945791186242264717105450032015121228883311310554307642616992497302908694717592433141297144432050368735795242641458340179574570677363094613194407659029479144680817795360430138274949852590078525956271272097617504628863359082722165988051428984350284590945634257023992112109603037913743881093449074739596518025367431357728010078740547844427806945121817630026106069016395628443335874134782223303836066466169610185611500914573834453767768700836697312298170873610903296071503436737775921179256883399734879952729442650214051716136162200565973531954800456343630305569794075157594061975830241309175110342403848770459253822108620055847537863112088953128637896629672657973454415069780665891387271359676420696094880725186108618297986550327395638179845946378371811775850249289852460431576998607184804764865455013595954142610967661806410362224594614800402524713334562398344216220581763873682384606166610604087656154832140923257965683768548028426257913893938075218051784056598869906431914676951171366763803312262722115100832954533306894248256469990901257248810156536808436047935297348759162789618289556994856258007070748274613561558988878973286485214901474312469472851917293326915087133466910661065483827540350325735017648347645483358455553932098063886086089832918391816577731474146242897081650327342629517247329512555799718613152621351015780248414663836212772350248797416726557930308465349936931637914677470247117736671011323370094555428428003694896986812165443724331662841353222117709106536768632436807694114348998425092314975151514349902761822641392758958228200580418449051260129472760424748785116212617553832462993604380017155996498328159332602314656558068420231439621189533513479647688540985812602871732045710938561302942032005728847351542772286352401345746248868174486971824954342522014596143265833726781848858981404642172075323751892847438407062717678257192175539339295868153593811648146623562313220546978665451442286522711883592593546980382891314918154277229422912908

Bob's Secret b = 512 bit random number (155 base10 digits):
pretty: 11,338,677,985,568,755,589,554,625,848,201,487,813,824,932,497,347,579,420,942,690,134,253,185,812,833,697,529,832,017,368,088,594,649,670,253,922,876,392,484,416,429,152,790,053,488,296,321,770,440,130,590
base10: 11338677985568755589554625848201487813824932497347579420942690134253185812833697529832017368088594649670253922876392484416429152790053488296321770440130590