[ Log On ]
  • Home
  • Tst
  • Cha
  • Enc
  • Code
  • IP
  • Fun
  • Sub
  • DigF
  • Cis
  • Com
  • Db
  • About
  • Netsim

Encryption Keys

[Back] Most programming language can only deal with 64-bit integers. If we need to deal with larger ones, we need to use additional libraries, such as Bouncy Castle, where we can declare Big Integers, such as:

Org.BouncyCastle.Math.BigInteger b = new Org.BouncyCastle.Math.BigInteger("2");
Org.BouncyCastle.Math.BigInteger c = b.Pow(i);

Using this code, this program uses Bouncy Castle to calculate the number of keys for various key sizes:

Key sizeNo of keys
1665,536
324,294,967,296
48281,474,976,710,656
6418,446,744,073,709,551,616
801,208,925,819,614,629,174,706,176
9679,228,162,514,264,337,593,543,950,336
1125,192,296,858,534,827,628,530,496,329,220,096
128340,282,366,920,938,463,463,374,607,431,768,211,456
14422,300,745,198,530,623,141,535,718,272,648,361,505,980,416
1601,461,501,637,330,902,918,203,684,832,716,283,019,655,932,542,97 6
17695,780,971,304,118,053,647,396,689,196,894,323,976,171,195,136,4 75,136
1926,277,101,735,386,680,763,835,789,423,207,666,416,102,355,444,46 4,034,512,896
208411,376,139,330,301,510,538,742,295,639,337,626,245,683,966,408, 394,965,837,152,256
22426,959,946,667,150,639,794,667,015,087,019,630,673,637,144,422,5 40,572,481,103,610,249,216
2401,766,847,064,778,384,329,583,297,500,742,918,515,827,483,896,87 5,618,958,121,606,201,292,619,776
256115,792,089,237,316,195,423,570,985,008,687,907,853,269,984,665, 640,564,039,457,584,007,913,129,639,936
2727,588,550,360,256,754,183,279,148,073,529,370,729,071,901,715,04 7,420,004,889,892,225,542,594,864,082,845,696
288497,323,236,409,786,642,155,382,248,146,820,840,100,456,150,797, 347,717,440,463,976,893,159,497,012,533,375,533,056
30432,592,575,621,351,777,380,295,131,014,550,050,576,823,494,298,6 54,980,010,178,247,189,670,100,796,213,387,298,934,358,016
3202,135,987,035,920,910,082,395,021,706,169,552,114,602,704,522,35 6,652,769,947,041,607,822,219,725,780,640,550,022,962,086,936,57 6
336139,984,046,386,112,763,159,840,142,535,527,767,382,602,843,577, 165,595,931,249,318,810,236,991,948,760,059,086,304,843,329,475, 444,736
3529,173,994,463,960,286,046,443,283,581,208,347,763,186,259,956,67 3,124,494,950,355,357,547,691,504,353,939,232,280,074,212,440,50 2,746,218,496
368601,226,901,190,101,306,339,707,032,778,070,279,008,174,732,520, 529,886,901,066,488,712,245,510,429,339,761,526,706,943,586,500, 787,976,175,353,856
38439,402,006,196,394,479,212,279,040,100,143,613,805,079,739,270,4 65,446,667,948,293,404,245,721,771,497,210,611,414,266,254,884,9 15,640,806,627,990,306,816
4002,582,249,878,086,908,589,655,919,172,003,011,874,329,705,792,82 9,223,512,830,659,356,540,647,622,016,841,194,629,645,353,280,13 7,831,435,903,171,972,747,493,376
416169,230,328,010,303,641,331,690,318,856,389,386,196,071,598,838, 855,992,136,870,091,590,247,882,556,495,704,531,248,437,872,567, 112,920,983,350,278,405,979,725,889,536
43211,090,678,776,483,259,438,313,656,736,572,334,813,745,748,301,5 03,266,300,681,918,322,458,485,231,222,502,492,159,897,624,416,5 58,312,389,564,843,845,614,287,315,896,631,296
448726,838,724,295,606,890,549,323,807,888,004,534,353,641,360,687, 318,060,281,490,199,180,639,288,113,397,923,326,191,050,713,763, 565,560,762,521,606,266,177,933,534,601,628,614,656
46447,634,102,635,436,893,179,040,485,073,748,265,163,400,240,214,0 04,076,398,607,741,693,502,376,385,799,646,303,105,256,699,577,2 09,032,590,132,615,988,260,237,052,123,652,332,890,095,616
4803,121,748,550,315,992,231,381,597,229,793,166,305,748,598,142,66 4,971,150,859,156,959,625,371,738,819,765,620,120,306,103,063,49 1,971,159,826,931,121,406,622,895,447,975,679,288,285,306,290,17 6
496204,586,912,993,508,866,875,824,356,051,724,947,013,540,127,877, 691,549,342,705,710,506,008,362,275,292,159,680,204,380,770,369, 009,821,930,417,757,972,504,438,076,078,534,117,837,065,833,032, 974,336
51213,407,807,929,942,597,099,574,024,998,205,846,127,479,365,820,5 92,393,377,723,561,443,721,764,030,073,546,976,801,874,298,166,9 03,427,690,031,858,186,486,050,853,753,882,811,946,569,946,433,6 49,006,084,096
7681,552,518,092,300,708,935,148,979,488,462,502,555,256,886,017,116,696,611,139,052,038,026,050,952,686,376,886,330,878,408,828,64 6,477,950,487,730,697,131,073,206,171,580,044,114,814,391,444,287,275,041,181,139,204,454,976,020,849,905,550,265,285,631,598,44 4,825,262,999,193,716,468,750,892,846,853,816,057,856
1024179,769,313,486,231,590,772,930,519,078,902,473,361,797,697,894,230,657,273,430,081,157,732,675,805,500,963,132,708,477,322,407, 536,021,120,113,879,871,393,357,658,789,768,814,416,622,492,847,430,639,474,124,377,767,893,424,865,485,276,302,219,601,246,094, 119,453,082,952,085,005,768,838,150,682,342,462,881,473,913,110,540,827,237,163,350,510,684,586,298,239,947,245,938,479,716,304, 835,356,329,624,224,137,216
128020,815,864,389,328,798,163,850,480,654,728,171,077,230,524,494,533,409,610,638,224,700,807,216,119,346,720,596,024,478,883,464,6 48,369,684,843,227,908,562,015,582,767,132,496,646,929,816,279,813,211,354,641,525,848,259,018,778,440,691,546,366,699,323,167,1 00,945,918,841,095,379,622,423,387,354,295,096,957,733,925,002,768,876,520,583,464,697,770,622,321,657,076,833,170,056,511,209,3 32,449,663,781,837,603,694,136,444,406,281,042,053,396,870,977,465,916,057,756,101,739,472,373,801,429,441,421,111,406,337,458,1 76
15362,410,312,426,921,032,588,580,116,606,028,314,112,912,093,247,945,688,951,359,675,039,065,257,391,591,803,200,669,085,024,107,34 6,049,663,448,766,280,888,004,787,862,416,978,794,958,324,969,612,987,890,774,651,455,213,339,381,625,224,770,782,077,917,681,49 9,676,845,543,137,387,820,057,597,345,857,904,599,109,461,387,122,099,507,964,997,815,641,342,300,677,629,473,355,281,617,428,41 1,794,163,967,785,870,370,368,969,109,221,591,943,054,232,011,562,758,450,080,579,587,850,900,993,714,892,283,476,646,631,181,51 5,063,804,873,375,182,260,506,246,992,837,898,705,971,012,525,843,324,401,232,986,857,004,760,339,316,736
1792279,095,111,627,852,376,407,822,673,918,065,072,905,887,935,345,660,252,615,989,519,488,029,661,278,604,994,789,701,101,367,875, 859,521,849,524,793,382,568,057,369,148,405,837,577,299,984,720,398,976,429,790,087,982,805,274,893,437,406,788,716,103,454,867, 635,208,144,157,749,912,668,657,006,085,226,160,261,808,841,484,862,703,257,771,979,713,923,863,820,038,729,637,520,989,894,984, 676,774,385,364,934,677,289,947,762,340,313,157,123,529,922,421,738,738,162,392,233,756,507,666,339,799,675,257,002,539,356,619, 747,080,176,786,496,732,679,854,783,185,583,233,878,234,270,370,065,954,615,221,443,190,595,445,898,747,930,123,678,952,192,875, 629,172,092,437,548,194,134,594,886,873,249,778,512,829,119,416,327,938,768,896
204832,317,006,071,311,007,300,714,876,688,669,951,960,444,102,669,715,484,032,130,345,427,524,655,138,867,890,893,197,201,411,522,9 13,463,688,717,960,921,898,019,494,119,559,150,490,921,095,088,152,386,448,283,120,630,877,367,300,996,091,750,197,750,389,652,1 06,796,057,638,384,067,568,276,792,218,642,619,756,161,838,094,338,476,170,470,581,645,852,036,305,042,887,575,891,541,065,808,6 07,552,399,123,930,385,521,914,333,389,668,342,420,684,974,786,564,569,494,856,176,035,326,322,058,077,805,659,331,026,192,708,4 60,314,150,258,592,864,177,116,725,943,603,718,461,857,357,598,351,152,301,645,904,403,697,613,233,287,231,227,125,684,710,820,2 09,725,157,101,726,931,323,469,678,542,580,656,697,935,045,997,268,352,998,638,215,525,166,389,437,335,543,602,135,433,229,604,6 45,318,478,604,952,148,193,555,853,611,059,596,230,656