Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 75.28 KB | None | 0 0
  1. using Mono.Math.Prime;
  2. using Mono.Math.Prime.Generator;
  3. using System;
  4. using System.Security.Cryptography;
  5.  
  6. namespace Mono.Math
  7. {
  8. internal class BigInteger
  9. {
  10. private const UInt32 DEFAULT_LEN = 20;
  11.  
  12. private const String WouldReturnNegVal = "Operation would return a negative value";
  13.  
  14. private UInt32 length = 1;
  15.  
  16. private UInt32[] data;
  17.  
  18. internal readonly static UInt32[] smallPrimes;
  19.  
  20. private static RandomNumberGenerator rng;
  21.  
  22. private static RandomNumberGenerator Rng
  23. {
  24. get
  25. {
  26. if (BigInteger.rng == null)
  27. {
  28. BigInteger.rng = RandomNumberGenerator.Create();
  29. }
  30. return BigInteger.rng;
  31. }
  32. }
  33.  
  34. static BigInteger()
  35. {
  36. BigInteger.smallPrimes = new UInt32[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987 };
  37. }
  38.  
  39. public BigInteger()
  40. {
  41. unsafe
  42. {
  43. this.data = new UInt32[20];
  44. this.length = 20;
  45. }
  46. }
  47.  
  48. public BigInteger(BigInteger.Sign sign, UInt32 len)
  49. {
  50. unsafe
  51. {
  52. this.data = new UInt32[len];
  53. this.length = len;
  54. }
  55. }
  56.  
  57. public BigInteger(BigInteger bi)
  58. {
  59. this.data = (UInt32[])bi.data.Clone();
  60. this.length = bi.length;
  61. }
  62.  
  63. public BigInteger(BigInteger bi, UInt32 len)
  64. {
  65. unsafe
  66. {
  67. this.data = new UInt32[len];
  68. for (UInt32 i = 0; i < bi.length; i++)
  69. {
  70. this.data[i] = bi.data[i];
  71. }
  72. this.length = bi.length;
  73. }
  74. }
  75.  
  76. public BigInteger(Byte[] inData)
  77. {
  78. unsafe
  79. {
  80. this.length = (UInt32)((Int32)inData.Length >> 2);
  81. Int32 length = (Int32)inData.Length & 3;
  82. if (length != 0)
  83. {
  84. BigInteger bigInteger = this;
  85. bigInteger.length = bigInteger.length + 1;
  86. }
  87. this.data = new UInt32[this.length];
  88. Int32 num = (Int32)inData.Length - 1;
  89. Int32 num1 = 0;
  90. while (num >= 3)
  91. {
  92. this.data[num1] = (UInt32)(inData[num - 3] << 24 | inData[num - 2] << 16 | inData[num - 1] << 8 | inData[num]);
  93. num = num - 4;
  94. num1++;
  95. }
  96. switch (length)
  97. {
  98. case 1:
  99. {
  100. this.data[this.length - 1] = inData[0];
  101. break;
  102. }
  103. case 2:
  104. {
  105. this.data[this.length - 1] = (UInt32)(inData[0] << 8 | inData[1]);
  106. break;
  107. }
  108. case 3:
  109. {
  110. this.data[this.length - 1] = (UInt32)(inData[0] << 16 | inData[1] << 8 | inData[2]);
  111. break;
  112. }
  113. }
  114. this.Normalize();
  115. }
  116. }
  117.  
  118. public BigInteger(UInt32[] inData)
  119. {
  120. unsafe
  121. {
  122. this.length = (UInt32)inData.Length;
  123. this.data = new UInt32[this.length];
  124. Int32 num = (Int32)(this.length - 1);
  125. Int32 num1 = 0;
  126. while (num >= 0)
  127. {
  128. this.data[num1] = inData[num];
  129. num--;
  130. num1++;
  131. }
  132. this.Normalize();
  133. }
  134. }
  135.  
  136. public BigInteger(UInt32 ui)
  137. {
  138. this.data = new UInt32[] { ui };
  139. }
  140.  
  141. public BigInteger(UInt64 ul)
  142. {
  143. this.data = new UInt32[] { (UInt32)ul, (UInt32)(ul >> 32) };
  144. this.length = 2;
  145. this.Normalize();
  146. }
  147.  
  148. public static BigInteger Add(BigInteger bi1, BigInteger bi2)
  149. {
  150. return bi1 + bi2;
  151. }
  152.  
  153. public Int32 BitCount()
  154. {
  155. unsafe
  156. {
  157. this.Normalize();
  158. UInt32 num = this.data[this.length - 1];
  159. UInt32 num1 = -2147483648;
  160. UInt32 num2 = 32;
  161. while (num2 > 0 && (num & num1) == 0)
  162. {
  163. num2--;
  164. num1 = num1 >> 1;
  165. }
  166. num2 = num2 + (this.length - 1 << 5);
  167. return (Int32)num2;
  168. }
  169. }
  170.  
  171. public Void Clear()
  172. {
  173. for (Int32 i = 0; (Int64)i < (UInt64)this.length; i++)
  174. {
  175. this.data[i] = 0;
  176. }
  177. }
  178.  
  179. public Void ClearBit(UInt32 bitNum)
  180. {
  181. this.SetBit(bitNum, false);
  182. }
  183.  
  184. public BigInteger.Sign Compare(BigInteger bi)
  185. {
  186. return BigInteger.Kernel.Compare(this, bi);
  187. }
  188.  
  189. public static BigInteger Divid(BigInteger bi, Int32 i)
  190. {
  191. return bi / i;
  192. }
  193.  
  194. public static BigInteger Divid(BigInteger bi1, BigInteger bi2)
  195. {
  196. return bi1 / bi2;
  197. }
  198.  
  199. public override Boolean Equals(Object o)
  200. {
  201. if (o == null)
  202. {
  203. return false;
  204. }
  205. if (o is Int32)
  206. {
  207. return ((Int32)o < 0 ? false : this == (UInt32)o);
  208. }
  209. BigInteger bigInteger = o as BigInteger;
  210. if (bigInteger == null)
  211. {
  212. return false;
  213. }
  214. return BigInteger.Kernel.Compare(this, bigInteger) == BigInteger.Sign.Zero;
  215. }
  216.  
  217. public BigInteger GCD(BigInteger bi)
  218. {
  219. return BigInteger.Kernel.gcd(this, bi);
  220. }
  221.  
  222. public static BigInteger GeneratePseudoPrime(Int32 bits)
  223. {
  224. return (new SequentialSearchPrimeGeneratorBase()).GenerateNewPrime(bits);
  225. }
  226.  
  227. public static BigInteger GenerateRandom(Int32 bits, RandomNumberGenerator rng)
  228. {
  229. Int32 num = bits >> 5;
  230. Int32 num1 = bits & 31;
  231. if (num1 != 0)
  232. {
  233. num++;
  234. }
  235. BigInteger bigInteger = new BigInteger(BigInteger.Sign.Positive, (UInt32)(num + 1));
  236. Byte[] numArray = new Byte[num << 2];
  237. rng.GetBytes(numArray);
  238. Buffer.BlockCopy(numArray, 0, bigInteger.data, 0, num << 2);
  239. if (num1 == 0)
  240. {
  241. bigInteger.data[num - 1] = bigInteger.data[num - 1] | -2147483648;
  242. }
  243. else
  244. {
  245. UInt32 num2 = (UInt32)(1 << (num1 - 1 & 31));
  246. bigInteger.data[num - 1] = bigInteger.data[num - 1] | num2;
  247. num2 = (UInt32)(-1 >> (32 - num1 & 31));
  248. bigInteger.data[num - 1] = bigInteger.data[num - 1] & num2;
  249. }
  250. bigInteger.Normalize();
  251. return bigInteger;
  252. }
  253.  
  254. public static BigInteger GenerateRandom(Int32 bits)
  255. {
  256. return BigInteger.GenerateRandom(bits, BigInteger.Rng);
  257. }
  258.  
  259. public Byte[] GetBytes()
  260. {
  261. if (this == 0)
  262. {
  263. return new Byte[1];
  264. }
  265. Int32 num = this.BitCount();
  266. Int32 num1 = num >> 3;
  267. if ((num & 7) != 0)
  268. {
  269. num1++;
  270. }
  271. Byte[] numArray = new Byte[num1];
  272. Int32 num2 = num1 & 3;
  273. if (num2 == 0)
  274. {
  275. num2 = 4;
  276. }
  277. Int32 num3 = 0;
  278. for (Int32 i = (Int32)(this.length - 1); i >= 0; i--)
  279. {
  280. UInt32 num4 = this.data[i];
  281. for (Int32 j = num2 - 1; j >= 0; j--)
  282. {
  283. numArray[num3 + j] = (Byte)(num4 & 255);
  284. num4 = num4 >> 8;
  285. }
  286. num3 = num3 + num2;
  287. num2 = 4;
  288. }
  289. return numArray;
  290. }
  291.  
  292. public override Int32 GetHashCode()
  293. {
  294. unsafe
  295. {
  296. UInt32 num = 0;
  297. for (UInt32 i = 0; i < this.length; i++)
  298. {
  299. num = num ^ this.data[i];
  300. }
  301. return (Int32)num;
  302. }
  303. }
  304.  
  305. public Void Incr2()
  306. {
  307. Int32 num = 0;
  308. this.data[0] = this.data[0] + 2;
  309. if (this.data[0] < 2)
  310. {
  311. Int32 num1 = num + 1;
  312. num = num1;
  313. this.data[num1] = this.data[num1] + 1;
  314. while (true)
  315. {
  316. Int32 num2 = num;
  317. num = num2 + 1;
  318. if (this.data[num2] != 0)
  319. {
  320. break;
  321. }
  322. this.data[num] = this.data[num] + 1;
  323. }
  324. if (this.length == num)
  325. {
  326. BigInteger bigInteger = this;
  327. bigInteger.length = bigInteger.length + 1;
  328. }
  329. }
  330. }
  331.  
  332. public Boolean IsProbablePrime()
  333. {
  334. if (this <= BigInteger.smallPrimes[(Int32)BigInteger.smallPrimes.Length - 1])
  335. {
  336. for (Int32 i = 0; i < (Int32)BigInteger.smallPrimes.Length; i++)
  337. {
  338. if (this == BigInteger.smallPrimes[i])
  339. {
  340. return true;
  341. }
  342. }
  343. return false;
  344. }
  345. for (Int32 j = 0; j < (Int32)BigInteger.smallPrimes.Length; j++)
  346. {
  347. if ((this % BigInteger.smallPrimes[j]) == 0)
  348. {
  349. return false;
  350. }
  351. }
  352. return PrimalityTests.Test(this, ConfidenceFactor.Medium);
  353. }
  354.  
  355. public Int32 LowestSetBit()
  356. {
  357. if (this == 0)
  358. {
  359. return -1;
  360. }
  361. Int32 num = 0;
  362. while (!this.TestBit(num))
  363. {
  364. num++;
  365. }
  366. return num;
  367. }
  368.  
  369. public BigInteger ModInverse(BigInteger modulus)
  370. {
  371. return BigInteger.Kernel.modInverse(this, modulus);
  372. }
  373.  
  374. public BigInteger ModPow(BigInteger exp, BigInteger n)
  375. {
  376. return (new BigInteger.ModulusRing(n)).Pow(this, exp);
  377. }
  378.  
  379. public static Int32 Modulus(BigInteger bi, Int32 i)
  380. {
  381. return bi % i;
  382. }
  383.  
  384. public static UInt32 Modulus(BigInteger bi, UInt32 ui)
  385. {
  386. return bi % ui;
  387. }
  388.  
  389. public static BigInteger Modulus(BigInteger bi1, BigInteger bi2)
  390. {
  391. return bi1 % bi2;
  392. }
  393.  
  394. public static BigInteger Multiply(BigInteger bi1, BigInteger bi2)
  395. {
  396. return bi1 * bi2;
  397. }
  398.  
  399. public static BigInteger Multiply(BigInteger bi, Int32 i)
  400. {
  401. return bi * i;
  402. }
  403.  
  404. public static BigInteger NextHighestPrime(BigInteger bi)
  405. {
  406. return (new NextPrimeFinder()).GenerateNewPrime(0, bi);
  407. }
  408.  
  409. private Void Normalize()
  410. {
  411. unsafe
  412. {
  413. while (this.length > 0 && this.data[this.length - 1] == 0)
  414. {
  415. BigInteger bigInteger = this;
  416. bigInteger.length = bigInteger.length - 1;
  417. }
  418. if (this.length == 0)
  419. {
  420. BigInteger bigInteger1 = this;
  421. bigInteger1.length = bigInteger1.length + 1;
  422. }
  423. }
  424. }
  425.  
  426. public static BigInteger operator +(BigInteger bi1, BigInteger bi2)
  427. {
  428. if (bi1 == 0)
  429. {
  430. return new BigInteger(bi2);
  431. }
  432. if (bi2 == 0)
  433. {
  434. return new BigInteger(bi1);
  435. }
  436. return BigInteger.Kernel.AddSameSign(bi1, bi2);
  437. }
  438.  
  439. public static BigInteger operator /(BigInteger bi, Int32 i)
  440. {
  441. if (i <= 0)
  442. {
  443. throw new ArithmeticException("Operation would return a negative value");
  444. }
  445. return BigInteger.Kernel.DwordDiv(bi, (UInt32)i);
  446. }
  447.  
  448. public static BigInteger operator /(BigInteger bi1, BigInteger bi2)
  449. {
  450. return BigInteger.Kernel.multiByteDivide(bi1, bi2)[0];
  451. }
  452.  
  453. public static Boolean operator ==(BigInteger bi1, UInt32 ui)
  454. {
  455. if (bi1.length != 1)
  456. {
  457. bi1.Normalize();
  458. }
  459. return (bi1.length != 1 ? false : bi1.data[0] == ui);
  460. }
  461.  
  462. public static Boolean operator ==(BigInteger bi1, BigInteger bi2)
  463. {
  464. if (bi1 == bi2)
  465. {
  466. return true;
  467. }
  468. if (null == bi1 || null == bi2)
  469. {
  470. return false;
  471. }
  472. return BigInteger.Kernel.Compare(bi1, bi2) == BigInteger.Sign.Zero;
  473. }
  474.  
  475. public static Boolean operator >(BigInteger bi1, BigInteger bi2)
  476. {
  477. return BigInteger.Kernel.Compare(bi1, bi2) > BigInteger.Sign.Zero;
  478. }
  479.  
  480. public static Boolean operator >=(BigInteger bi1, BigInteger bi2)
  481. {
  482. return BigInteger.Kernel.Compare(bi1, bi2) >= BigInteger.Sign.Zero;
  483. }
  484.  
  485. public static implicit operator BigInteger(UInt32 value)
  486. {
  487. return new BigInteger(value);
  488. }
  489.  
  490. public static implicit operator BigInteger(Int32 value)
  491. {
  492. if (value < 0)
  493. {
  494. throw new ArgumentOutOfRangeException("value");
  495. }
  496. return new BigInteger((UInt32)value);
  497. }
  498.  
  499. public static implicit operator BigInteger(UInt64 value)
  500. {
  501. return new BigInteger(value);
  502. }
  503.  
  504. public static Boolean operator !=(BigInteger bi1, UInt32 ui)
  505. {
  506. if (bi1.length != 1)
  507. {
  508. bi1.Normalize();
  509. }
  510. return (bi1.length != 1 ? 0 : (Int32)(bi1.data[0] == ui)) == 0;
  511. }
  512.  
  513. public static Boolean operator !=(BigInteger bi1, BigInteger bi2)
  514. {
  515. if (bi1 == bi2)
  516. {
  517. return false;
  518. }
  519. if (null == bi1 || null == bi2)
  520. {
  521. return true;
  522. }
  523. return BigInteger.Kernel.Compare(bi1, bi2) != BigInteger.Sign.Zero;
  524. }
  525.  
  526. public static BigInteger operator <<(BigInteger bi1, Int32 shiftVal)
  527. {
  528. return BigInteger.Kernel.LeftShift(bi1, shiftVal);
  529. }
  530.  
  531. public static Boolean operator <(BigInteger bi1, BigInteger bi2)
  532. {
  533. return BigInteger.Kernel.Compare(bi1, bi2) < BigInteger.Sign.Zero;
  534. }
  535.  
  536. public static Boolean operator <=(BigInteger bi1, BigInteger bi2)
  537. {
  538. return BigInteger.Kernel.Compare(bi1, bi2) <= BigInteger.Sign.Zero;
  539. }
  540.  
  541. public static Int32 operator %(BigInteger bi, Int32 i)
  542. {
  543. if (i > 0)
  544. {
  545. return (Int32)BigInteger.Kernel.DwordMod(bi, (UInt32)i);
  546. }
  547. return (Int32)(-BigInteger.Kernel.DwordMod(bi, (UInt32)(-i)));
  548. }
  549.  
  550. public static UInt32 operator %(BigInteger bi, UInt32 ui)
  551. {
  552. return BigInteger.Kernel.DwordMod(bi, ui);
  553. }
  554.  
  555. public static BigInteger operator %(BigInteger bi1, BigInteger bi2)
  556. {
  557. return BigInteger.Kernel.multiByteDivide(bi1, bi2)[1];
  558. }
  559.  
  560. public static BigInteger operator *(BigInteger bi1, BigInteger bi2)
  561. {
  562. if (bi1 == 0 || bi2 == 0)
  563. {
  564. return 0;
  565. }
  566. if ((Int64)((Int32)bi1.data.Length) < (UInt64)bi1.length)
  567. {
  568. throw new IndexOutOfRangeException("bi1 out of range");
  569. }
  570. if ((Int64)((Int32)bi2.data.Length) < (UInt64)bi2.length)
  571. {
  572. throw new IndexOutOfRangeException("bi2 out of range");
  573. }
  574. BigInteger bigInteger = new BigInteger(BigInteger.Sign.Positive, bi1.length + bi2.length);
  575. BigInteger.Kernel.Multiply(bi1.data, 0, bi1.length, bi2.data, 0, bi2.length, bigInteger.data, 0);
  576. bigInteger.Normalize();
  577. return bigInteger;
  578. }
  579.  
  580. public static BigInteger operator *(BigInteger bi, Int32 i)
  581. {
  582. if (i < 0)
  583. {
  584. throw new ArithmeticException("Operation would return a negative value");
  585. }
  586. if (i == 0)
  587. {
  588. return 0;
  589. }
  590. if (i == 1)
  591. {
  592. return new BigInteger(bi);
  593. }
  594. return BigInteger.Kernel.MultiplyByDword(bi, (UInt32)i);
  595. }
  596.  
  597. public static BigInteger operator >>(BigInteger bi1, Int32 shiftVal)
  598. {
  599. return BigInteger.Kernel.RightShift(bi1, shiftVal);
  600. }
  601.  
  602. public static BigInteger operator -(BigInteger bi1, BigInteger bi2)
  603. {
  604. if (bi2 == 0)
  605. {
  606. return new BigInteger(bi1);
  607. }
  608. if (bi1 == 0)
  609. {
  610. throw new ArithmeticException("Operation would return a negative value");
  611. }
  612. switch (BigInteger.Kernel.Compare(bi1, bi2))
  613. {
  614. case BigInteger.Sign.Negative:
  615. {
  616. throw new ArithmeticException("Operation would return a negative value");
  617. }
  618. case BigInteger.Sign.Zero:
  619. {
  620. return 0;
  621. }
  622. case BigInteger.Sign.Positive:
  623. {
  624. return BigInteger.Kernel.Subtract(bi1, bi2);
  625. }
  626. }
  627. throw new Exception();
  628. }
  629.  
  630. public static BigInteger Parse(String number)
  631. {
  632. if (number == null)
  633. {
  634. throw new ArgumentNullException("number");
  635. }
  636. Int32 i = 0;
  637. Int32 length = number.Length;
  638. Boolean flag = false;
  639. BigInteger bigInteger = new BigInteger(0);
  640. if (number[i] == '+')
  641. {
  642. i++;
  643. }
  644. else if (number[i] == '-')
  645. {
  646. throw new FormatException("Operation would return a negative value");
  647. }
  648. while (i < length)
  649. {
  650. Char chr = number[i];
  651. if (chr == 0)
  652. {
  653. i = length;
  654. }
  655. else if (chr < '0' || chr > '9')
  656. {
  657. if (!Char.IsWhiteSpace(chr))
  658. {
  659. throw new FormatException();
  660. }
  661. for (i++; i < length; i++)
  662. {
  663. if (!Char.IsWhiteSpace(number[i]))
  664. {
  665. throw new FormatException();
  666. }
  667. }
  668. break;
  669. }
  670. else
  671. {
  672. bigInteger = (bigInteger * 10) + (chr - 48);
  673. flag = true;
  674. }
  675. i++;
  676. }
  677. if (!flag)
  678. {
  679. throw new FormatException();
  680. }
  681. return bigInteger;
  682. }
  683.  
  684. public Void Randomize(RandomNumberGenerator rng)
  685. {
  686. if (this == 0)
  687. {
  688. return;
  689. }
  690. Int32 num = this.BitCount();
  691. Int32 num1 = num >> 5;
  692. Int32 num2 = num & 31;
  693. if (num2 != 0)
  694. {
  695. num1++;
  696. }
  697. Byte[] numArray = new Byte[num1 << 2];
  698. rng.GetBytes(numArray);
  699. Buffer.BlockCopy(numArray, 0, this.data, 0, num1 << 2);
  700. if (num2 == 0)
  701. {
  702. this.data[num1 - 1] = this.data[num1 - 1] | -2147483648;
  703. }
  704. else
  705. {
  706. UInt32 num3 = (UInt32)(1 << (num2 - 1 & 31));
  707. this.data[num1 - 1] = this.data[num1 - 1] | num3;
  708. num3 = (UInt32)(-1 >> (32 - num2 & 31));
  709. this.data[num1 - 1] = this.data[num1 - 1] & num3;
  710. }
  711. this.Normalize();
  712. }
  713.  
  714. public Void Randomize()
  715. {
  716. this.Randomize(BigInteger.Rng);
  717. }
  718.  
  719. public Void SetBit(UInt32 bitNum)
  720. {
  721. this.SetBit(bitNum, true);
  722. }
  723.  
  724. public Void SetBit(UInt32 bitNum, Boolean value)
  725. {
  726. unsafe
  727. {
  728. UInt32 num = bitNum >> 5;
  729. if (num < this.length)
  730. {
  731. UInt32 num1 = 1 << (bitNum & 31 & 31);
  732. if (!value)
  733. {
  734. this.data[num] = this.data[num] & ~num1;
  735. }
  736. else
  737. {
  738. this.data[num] = this.data[num] | num1;
  739. }
  740. }
  741. }
  742. }
  743.  
  744. public static BigInteger Subtract(BigInteger bi1, BigInteger bi2)
  745. {
  746. return bi1 - bi2;
  747. }
  748.  
  749. public Boolean TestBit(UInt32 bitNum)
  750. {
  751. unsafe
  752. {
  753. UInt32 num = bitNum >> 5;
  754. UInt32 num1 = (UInt32)(1 << ((Byte)(bitNum & 31) & 31));
  755. return (this.data[num] & num1) != 0;
  756. }
  757. }
  758.  
  759. public Boolean TestBit(Int32 bitNum)
  760. {
  761. unsafe
  762. {
  763. if (bitNum < 0)
  764. {
  765. throw new IndexOutOfRangeException("bitNum out of range");
  766. }
  767. UInt32 num = (UInt32)(bitNum >> 5);
  768. UInt32 num1 = (UInt32)(1 << ((Byte)(bitNum & 31) & 31));
  769. return (this.data[num] | num1) == this.data[num];
  770. }
  771. }
  772.  
  773. public String ToString(UInt32 radix)
  774. {
  775. return this.ToString(radix, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
  776. }
  777.  
  778. public String ToString(UInt32 radix, String characterSet)
  779. {
  780. if ((Int64)characterSet.Length < (UInt64)radix)
  781. {
  782. throw new ArgumentException("charSet length less than radix", "characterSet");
  783. }
  784. if (radix == 1)
  785. {
  786. throw new ArgumentException("There is no such thing as radix one notation", "radix");
  787. }
  788. if (this == 0)
  789. {
  790. return "0";
  791. }
  792. if (this == 1)
  793. {
  794. return "1";
  795. }
  796. String empty = String.Empty;
  797. BigInteger bigInteger = new BigInteger(this);
  798. while (bigInteger != 0)
  799. {
  800. UInt32 num = BigInteger.Kernel.SingleByteDivideInPlace(bigInteger, radix);
  801. empty = String.Concat(characterSet[num], empty);
  802. }
  803. return empty;
  804. }
  805.  
  806. public override String ToString()
  807. {
  808. return this.ToString(10);
  809. }
  810.  
  811. private sealed class Kernel
  812. {
  813. public Kernel()
  814. {
  815. }
  816.  
  817. public static BigInteger AddSameSign(BigInteger bi1, BigInteger bi2)
  818. {
  819. unsafe
  820. {
  821. UInt32[] numArray;
  822. UInt32[] numArray1;
  823. UInt32 num;
  824. UInt32 num1;
  825. UInt32 num2;
  826. UInt32 num3;
  827. UInt32 num4;
  828. UInt32 num5 = 0;
  829. if (bi1.length >= bi2.length)
  830. {
  831. numArray = bi1.data;
  832. num1 = bi1.length;
  833. numArray1 = bi2.data;
  834. num = bi2.length;
  835. }
  836. else
  837. {
  838. numArray = bi2.data;
  839. num1 = bi2.length;
  840. numArray1 = bi1.data;
  841. num = bi1.length;
  842. }
  843. BigInteger bigInteger = new BigInteger(BigInteger.Sign.Positive, num1 + 1);
  844. UInt32[] numArray2 = bigInteger.data;
  845. UInt64 num6 = (UInt64)0;
  846. do
  847. {
  848. num6 = (UInt64)numArray[num5] + (UInt64)numArray1[num5] + num6;
  849. numArray2[num5] = (UInt32)num6;
  850. num6 = num6 >> 32;
  851. num2 = num5 + 1;
  852. num5 = num2;
  853. }
  854. while (num2 < num);
  855. Boolean flag = num6 != (Int64)0;
  856. if (flag)
  857. {
  858. if (num5 < num1)
  859. {
  860. do
  861. {
  862. UInt32 num7 = numArray[num5] + 1;
  863. UInt32 num8 = num7;
  864. numArray2[num5] = num7;
  865. flag = num8 == 0;
  866. num4 = num5 + 1;
  867. num5 = num4;
  868. }
  869. while (num4 < num1 && flag);
  870. }
  871. if (flag)
  872. {
  873. numArray2[num5] = 1;
  874. UInt32 num9 = num5 + 1;
  875. num5 = num9;
  876. bigInteger.length = num9;
  877. return bigInteger;
  878. }
  879. }
  880. if (num5 < num1)
  881. {
  882. do
  883. {
  884. numArray2[num5] = numArray[num5];
  885. num3 = num5 + 1;
  886. num5 = num3;
  887. }
  888. while (num3 < num1);
  889. }
  890. bigInteger.Normalize();
  891. return bigInteger;
  892. }
  893. }
  894.  
  895. public static BigInteger.Sign Compare(BigInteger bi1, BigInteger bi2)
  896. {
  897. unsafe
  898. {
  899. UInt32 num = bi1.length;
  900. UInt32 num1 = bi2.length;
  901. while (num > 0 && bi1.data[num - 1] == 0)
  902. {
  903. num--;
  904. }
  905. while (num1 > 0 && bi2.data[num1 - 1] == 0)
  906. {
  907. num1--;
  908. }
  909. if (num == 0 && num1 == 0)
  910. {
  911. return BigInteger.Sign.Zero;
  912. }
  913. if (num < num1)
  914. {
  915. return BigInteger.Sign.Negative;
  916. }
  917. if (num > num1)
  918. {
  919. return BigInteger.Sign.Positive;
  920. }
  921. UInt32 num2 = num - 1;
  922. while (num2 != 0 && bi1.data[num2] == bi2.data[num2])
  923. {
  924. num2--;
  925. }
  926. if (bi1.data[num2] < bi2.data[num2])
  927. {
  928. return BigInteger.Sign.Negative;
  929. }
  930. if (bi1.data[num2] > bi2.data[num2])
  931. {
  932. return BigInteger.Sign.Positive;
  933. }
  934. return BigInteger.Sign.Zero;
  935. }
  936. }
  937.  
  938. public static BigInteger DwordDiv(BigInteger n, UInt32 d)
  939. {
  940. unsafe
  941. {
  942. BigInteger bigInteger = new BigInteger(BigInteger.Sign.Positive, n.length);
  943. UInt64 num = (UInt64)0;
  944. UInt32 num1 = n.length;
  945. while (true)
  946. {
  947. UInt32 num2 = num1;
  948. num1 = num2 - 1;
  949. if (num2 <= 0)
  950. {
  951. break;
  952. }
  953. num = num << 32;
  954. num = num | (UInt64)n.data[num1];
  955. bigInteger.data[num1] = (UInt32)(num / (UInt64)d);
  956. num = num % (UInt64)d;
  957. }
  958. bigInteger.Normalize();
  959. return bigInteger;
  960. }
  961. }
  962.  
  963. public static BigInteger[] DwordDivMod(BigInteger n, UInt32 d)
  964. {
  965. unsafe
  966. {
  967. BigInteger bigInteger = new BigInteger(BigInteger.Sign.Positive, n.length);
  968. UInt64 num = (UInt64)0;
  969. UInt32 num1 = n.length;
  970. while (true)
  971. {
  972. UInt32 num2 = num1;
  973. num1 = num2 - 1;
  974. if (num2 <= 0)
  975. {
  976. break;
  977. }
  978. num = num << 32;
  979. num = num | (UInt64)n.data[num1];
  980. bigInteger.data[num1] = (UInt32)(num / (UInt64)d);
  981. num = num % (UInt64)d;
  982. }
  983. bigInteger.Normalize();
  984. return new BigInteger[] { bigInteger, (UInt32)num };
  985. }
  986. }
  987.  
  988. public static UInt32 DwordMod(BigInteger n, UInt32 d)
  989. {
  990. unsafe
  991. {
  992. UInt64 num = (UInt64)0;
  993. UInt32 num1 = n.length;
  994. while (true)
  995. {
  996. UInt32 num2 = num1;
  997. num1 = num2 - 1;
  998. if (num2 <= 0)
  999. {
  1000. break;
  1001. }
  1002. num = num << 32;
  1003. num = num | (UInt64)n.data[num1];
  1004. num = num % (UInt64)d;
  1005. }
  1006. return (UInt32)num;
  1007. }
  1008. }
  1009.  
  1010. public static BigInteger gcd(BigInteger a, BigInteger b)
  1011. {
  1012. BigInteger bigInteger = a;
  1013. BigInteger bigInteger1 = b;
  1014. BigInteger bigInteger2 = bigInteger1;
  1015. while (bigInteger.length > 1)
  1016. {
  1017. bigInteger2 = bigInteger;
  1018. bigInteger = bigInteger1 % bigInteger;
  1019. bigInteger1 = bigInteger2;
  1020. }
  1021. if (bigInteger == 0)
  1022. {
  1023. return bigInteger2;
  1024. }
  1025. UInt32 num = bigInteger.data[0];
  1026. UInt32 num1 = bigInteger1 % num;
  1027. Int32 num2 = 0;
  1028. while (((num1 | num) & 1) == 0)
  1029. {
  1030. num1 = num1 >> 1;
  1031. num = num >> 1;
  1032. num2++;
  1033. }
  1034. while (num1 != 0)
  1035. {
  1036. while ((num1 & 1) == 0)
  1037. {
  1038. num1 = num1 >> 1;
  1039. }
  1040. while ((num & 1) == 0)
  1041. {
  1042. num = num >> 1;
  1043. }
  1044. if (num1 < num)
  1045. {
  1046. num = num - num1 >> 1;
  1047. }
  1048. else
  1049. {
  1050. num1 = num1 - num >> 1;
  1051. }
  1052. }
  1053. return num << (num2 & 31);
  1054. }
  1055.  
  1056. public static BigInteger LeftShift(BigInteger bi, Int32 n)
  1057. {
  1058. unsafe
  1059. {
  1060. if (n == 0)
  1061. {
  1062. return new BigInteger(bi, bi.length + 1);
  1063. }
  1064. Int32 num = n >> 5;
  1065. n = n & 31;
  1066. BigInteger bigInteger = new BigInteger(BigInteger.Sign.Positive, bi.length + 1 + num);
  1067. UInt32 num1 = 0;
  1068. UInt32 num2 = bi.length;
  1069. if (n == 0)
  1070. {
  1071. while (num1 < num2)
  1072. {
  1073. bigInteger.data[checked((IntPtr)((UInt64)num1 + (Int64)num))] = bi.data[num1];
  1074. num1++;
  1075. }
  1076. }
  1077. else
  1078. {
  1079. UInt32 num3 = 0;
  1080. while (num1 < num2)
  1081. {
  1082. UInt32 num4 = bi.data[num1];
  1083. bigInteger.data[checked((IntPtr)((UInt64)num1 + (Int64)num))] = num4 << (n & 31) | num3;
  1084. num3 = num4 >> (32 - n & 31);
  1085. num1++;
  1086. }
  1087. bigInteger.data[checked((IntPtr)((UInt64)num1 + (Int64)num))] = num3;
  1088. }
  1089. bigInteger.Normalize();
  1090. return bigInteger;
  1091. }
  1092. }
  1093.  
  1094. public static Void MinusEq(BigInteger big, BigInteger small)
  1095. {
  1096. unsafe
  1097. {
  1098. UInt32 num;
  1099. UInt32 num1;
  1100. UInt32[] numArray = big.data;
  1101. UInt32[] numArray1 = small.data;
  1102. UInt32 num2 = 0;
  1103. UInt32 num3 = 0;
  1104. do
  1105. {
  1106. UInt32 num4 = numArray1[num2];
  1107. UInt32 num5 = num4 + num3;
  1108. num4 = num5;
  1109. UInt32 num6 = numArray[num2] - num4;
  1110. UInt32 num7 = num6;
  1111. numArray[num2] = num6;
  1112. num3 = (UInt32)((!(num5 < num3 | num7 > ~num4) ? 0 : 1));
  1113. num = num2 + 1;
  1114. num2 = num;
  1115. }
  1116. while (num < small.length);
  1117. if (num2 != big.length)
  1118. {
  1119. if (num3 == 1)
  1120. {
  1121. do
  1122. {
  1123. numArray[num2] = numArray[num2] - 1;
  1124. num1 = num2;
  1125. num2 = num1 + 1;
  1126. }
  1127. while (numArray[num1] == 0 && num2 < big.length);
  1128. }
  1129. }
  1130. while (big.length > 0 && big.data[big.length - 1] == 0)
  1131. {
  1132. BigInteger bigInteger = big;
  1133. bigInteger.length = bigInteger.length - 1;
  1134. }
  1135. if (big.length == 0)
  1136. {
  1137. BigInteger bigInteger1 = big;
  1138. bigInteger1.length = bigInteger1.length + 1;
  1139. }
  1140. }
  1141. }
  1142.  
  1143. public static UInt32 modInverse(BigInteger bi, UInt32 modulus)
  1144. {
  1145. UInt32 num = modulus;
  1146. UInt32 num1 = bi % modulus;
  1147. UInt32 num2 = 0;
  1148. UInt32 num3 = 1;
  1149. while (num1 != 0)
  1150. {
  1151. if (num1 == 1)
  1152. {
  1153. return num3;
  1154. }
  1155. num2 = num2 + num / num1 * num3;
  1156. num = num % num1;
  1157. if (num != 0)
  1158. {
  1159. if (num == 1)
  1160. {
  1161. return modulus - num2;
  1162. }
  1163. num3 = num3 + num1 / num * num2;
  1164. num1 = num1 % num;
  1165. }
  1166. else
  1167. {
  1168. break;
  1169. }
  1170. }
  1171. return (UInt32)0;
  1172. }
  1173.  
  1174. public static BigInteger modInverse(BigInteger bi, BigInteger modulus)
  1175. {
  1176. if (modulus.length == 1)
  1177. {
  1178. return BigInteger.Kernel.modInverse(bi, modulus.data[0]);
  1179. }
  1180. BigInteger[] bigIntegerArray = new BigInteger[] { 0, 1 };
  1181. BigInteger[] bigIntegerArray1 = new BigInteger[2];
  1182. BigInteger[] bigIntegerArray2 = new BigInteger[] { 0, 0 };
  1183. Int32 num = 0;
  1184. BigInteger bigInteger = modulus;
  1185. BigInteger bigInteger1 = bi;
  1186. BigInteger.ModulusRing modulusRing = new BigInteger.ModulusRing(modulus);
  1187. while (bigInteger1 != 0)
  1188. {
  1189. if (num > 1)
  1190. {
  1191. BigInteger bigInteger2 = modulusRing.Difference(bigIntegerArray[0], bigIntegerArray[1] * bigIntegerArray1[0]);
  1192. bigIntegerArray[0] = bigIntegerArray[1];
  1193. bigIntegerArray[1] = bigInteger2;
  1194. }
  1195. BigInteger[] bigIntegerArray3 = BigInteger.Kernel.multiByteDivide(bigInteger, bigInteger1);
  1196. bigIntegerArray1[0] = bigIntegerArray1[1];
  1197. bigIntegerArray1[1] = bigIntegerArray3[0];
  1198. bigIntegerArray2[0] = bigIntegerArray2[1];
  1199. bigIntegerArray2[1] = bigIntegerArray3[1];
  1200. bigInteger = bigInteger1;
  1201. bigInteger1 = bigIntegerArray3[1];
  1202. num++;
  1203. }
  1204. if (bigIntegerArray2[0] != 1)
  1205. {
  1206. throw new ArithmeticException("No inverse!");
  1207. }
  1208. return modulusRing.Difference(bigIntegerArray[0], bigIntegerArray[1] * bigIntegerArray1[0]);
  1209. }
  1210.  
  1211. public static BigInteger[] multiByteDivide(BigInteger bi1, BigInteger bi2)
  1212. {
  1213. unsafe
  1214. {
  1215. if (BigInteger.Kernel.Compare(bi1, bi2) == BigInteger.Sign.Negative)
  1216. {
  1217. return new BigInteger[] { 0, new BigInteger(bi1) };
  1218. }
  1219. bi1.Normalize();
  1220. bi2.Normalize();
  1221. if (bi2.length == 1)
  1222. {
  1223. return BigInteger.Kernel.DwordDivMod(bi1, bi2.data[0]);
  1224. }
  1225. UInt32 num = bi1.length + 1;
  1226. Int32 num1 = (Int32)(bi2.length + 1);
  1227. UInt32 num2 = -2147483648;
  1228. UInt32 num3 = bi2.data[bi2.length - 1];
  1229. Int32 num4 = 0;
  1230. Int32 num5 = (Int32)(bi1.length - bi2.length);
  1231. while (num2 != 0 && (num3 & num2) == 0)
  1232. {
  1233. num4++;
  1234. num2 = num2 >> 1;
  1235. }
  1236. BigInteger bigInteger = new BigInteger(BigInteger.Sign.Positive, bi1.length - bi2.length + 1);
  1237. BigInteger bigInteger1 = bi1 << num4;
  1238. UInt32[] numArray = bigInteger1.data;
  1239. bi2 = bi2 << num4;
  1240. Int32 num6 = (Int32)(num - bi2.length);
  1241. Int32 num7 = (Int32)(num - 1);
  1242. UInt32 num8 = bi2.data[bi2.length - 1];
  1243. UInt64 num9 = (UInt64)bi2.data[bi2.length - 2];
  1244. while (num6 > 0)
  1245. {
  1246. UInt64 num10 = ((UInt64)numArray[num7] << 32) + (UInt64)numArray[num7 - 1];
  1247. UInt64 num11 = num10 / (UInt64)num8;
  1248. UInt64 num12 = num10 % (UInt64)num8;
  1249. while (num11 == 4294967296L || num11 * num9 > (num12 << 32) + (UInt64)numArray[num7 - 2])
  1250. {
  1251. num11 = num11 - (Int64)1;
  1252. num12 = num12 + (UInt64)num8;
  1253. if (num12 >= 4294967296L)
  1254. {
  1255. break;
  1256. }
  1257. }
  1258. UInt32 num13 = 0;
  1259. Int32 num14 = num7 - num1 + 1;
  1260. UInt64 num15 = (UInt64)0;
  1261. UInt32 num16 = (UInt32)num11;
  1262. do
  1263. {
  1264. num15 = num15 + (UInt64)bi2.data[num13] * (UInt64)num16;
  1265. UInt32 num17 = numArray[num14];
  1266. numArray[num14] = numArray[num14] - (UInt32)num15;
  1267. num15 = num15 >> 32;
  1268. if (numArray[num14] > num17)
  1269. {
  1270. num15 = num15 + (Int64)1;
  1271. }
  1272. num13++;
  1273. num14++;
  1274. }
  1275. while ((UInt64)num13 < (Int64)num1);
  1276. num14 = num7 - num1 + 1;
  1277. num13 = 0;
  1278. if (num15 != 0)
  1279. {
  1280. num16--;
  1281. UInt64 num18 = (UInt64)0;
  1282. do
  1283. {
  1284. num18 = (UInt64)numArray[num14] + (UInt64)bi2.data[num13] + num18;
  1285. numArray[num14] = (UInt32)num18;
  1286. num18 = num18 >> 32;
  1287. num13++;
  1288. num14++;
  1289. }
  1290. while ((UInt64)num13 < (Int64)num1);
  1291. }
  1292. Int32 num19 = num5;
  1293. num5 = num19 - 1;
  1294. bigInteger.data[num19] = num16;
  1295. num7--;
  1296. num6--;
  1297. }
  1298. bigInteger.Normalize();
  1299. bigInteger1.Normalize();
  1300. BigInteger[] bigIntegerArray = new BigInteger[] { bigInteger, bigInteger1 };
  1301. if (num4 != 0)
  1302. {
  1303. bigIntegerArray[1] = bigIntegerArray[1] >> num4;
  1304. }
  1305. return bigIntegerArray;
  1306. }
  1307. }
  1308.  
  1309. public static unsafe Void Multiply(UInt32[] x, UInt32 xOffset, UInt32 xLen, UInt32[] y, UInt32 yOffset, UInt32 yLen, UInt32[] d, UInt32 dOffset)
  1310. {
  1311. UInt32* numPointer;
  1312. UInt32* numPointer1;
  1313. UInt32* numPointer2;
  1314. if (x == null || (Int32)x.Length == 0)
  1315. {
  1316. numPointer = null;
  1317. }
  1318. else
  1319. {
  1320. numPointer = &x[0];
  1321. }
  1322. fixed (UInt32* numPointer3 = numPointer)
  1323. {
  1324. if (y == null || (Int32)y.Length == 0)
  1325. {
  1326. numPointer1 = null;
  1327. }
  1328. else
  1329. {
  1330. numPointer1 = &y[0];
  1331. }
  1332. fixed (UInt32* numPointer4 = numPointer1)
  1333. {
  1334. if (d == null || (Int32)d.Length == 0)
  1335. {
  1336. numPointer2 = null;
  1337. }
  1338. else
  1339. {
  1340. numPointer2 = &d[0];
  1341. }
  1342. fixed (UInt32* numPointer5 = numPointer2)
  1343. {
  1344. UInt32* numPointer6 = numPointer3 + xOffset * 4;
  1345. UInt32* numPointer7 = numPointer6 + xLen * 4;
  1346. UInt32* numPointer8 = numPointer4 + yOffset * 4;
  1347. UInt32* numPointer9 = numPointer8 + yLen * 4;
  1348. UInt32* numPointer10 = numPointer5 + dOffset * 4;
  1349. while (numPointer6 < numPointer7)
  1350. {
  1351. if (*numPointer6 != 0)
  1352. {
  1353. UInt64 num = (UInt64)0;
  1354. UInt32* numPointer11 = numPointer10;
  1355. UInt32* numPointer12 = numPointer8;
  1356. while (numPointer12 < numPointer9)
  1357. {
  1358. num = num + (UInt64)(*numPointer6) * (UInt64)(*numPointer12) + (UInt64)(*numPointer11);
  1359. *numPointer11 = (UInt32)num;
  1360. num = num >> 32;
  1361. numPointer12 = numPointer12 + 4;
  1362. numPointer11 = numPointer11 + 4;
  1363. }
  1364. if (num != 0)
  1365. {
  1366. *numPointer11 = (UInt32)num;
  1367. }
  1368. }
  1369. numPointer6 = numPointer6 + 4;
  1370. numPointer10 = numPointer10 + 4;
  1371. }
  1372. }
  1373. }
  1374. }
  1375. numPointer4 = null;
  1376. numPointer5 = null;
  1377. }
  1378.  
  1379. public static BigInteger MultiplyByDword(BigInteger n, UInt32 f)
  1380. {
  1381. unsafe
  1382. {
  1383. UInt32 num;
  1384. BigInteger bigInteger = new BigInteger(BigInteger.Sign.Positive, n.length + 1);
  1385. UInt32 num1 = 0;
  1386. UInt64 num2 = (UInt64)0;
  1387. do
  1388. {
  1389. num2 = num2 + (UInt64)n.data[num1] * (UInt64)f;
  1390. bigInteger.data[num1] = (UInt32)num2;
  1391. num2 = num2 >> 32;
  1392. num = num1 + 1;
  1393. num1 = num;
  1394. }
  1395. while (num < n.length);
  1396. bigInteger.data[num1] = (UInt32)num2;
  1397. bigInteger.Normalize();
  1398. return bigInteger;
  1399. }
  1400. }
  1401.  
  1402. public static unsafe Void MultiplyMod2p32pmod(UInt32[] x, Int32 xOffset, Int32 xLen, UInt32[] y, Int32 yOffest, Int32 yLen, UInt32[] d, Int32 dOffset, Int32 mod)
  1403. {
  1404. UInt32* numPointer;
  1405. UInt32* numPointer1;
  1406. UInt32* numPointer2;
  1407. if (x == null || (Int32)x.Length == 0)
  1408. {
  1409. numPointer = null;
  1410. }
  1411. else
  1412. {
  1413. numPointer = &x[0];
  1414. }
  1415. fixed (UInt32* numPointer3 = numPointer)
  1416. {
  1417. if (y == null || (Int32)y.Length == 0)
  1418. {
  1419. numPointer1 = null;
  1420. }
  1421. else
  1422. {
  1423. numPointer1 = &y[0];
  1424. }
  1425. fixed (UInt32* numPointer4 = numPointer1)
  1426. {
  1427. if (d == null || (Int32)d.Length == 0)
  1428. {
  1429. numPointer2 = null;
  1430. }
  1431. else
  1432. {
  1433. numPointer2 = &d[0];
  1434. }
  1435. fixed (UInt32* numPointer5 = numPointer2)
  1436. {
  1437. UInt32* numPointer6 = numPointer3 + xOffset * 4;
  1438. UInt32* numPointer7 = numPointer6 + xLen * 4;
  1439. UInt32* numPointer8 = numPointer4 + yOffest * 4;
  1440. UInt32* numPointer9 = numPointer8 + yLen * 4;
  1441. UInt32* numPointer10 = numPointer5 + dOffset * 4;
  1442. UInt32* numPointer11 = numPointer10 + mod * 4;
  1443. while (numPointer6 < numPointer7)
  1444. {
  1445. if (*numPointer6 != 0)
  1446. {
  1447. UInt64 num = (UInt64)0;
  1448. UInt32* numPointer12 = numPointer10;
  1449. UInt32* numPointer13 = numPointer8;
  1450. while (numPointer13 < numPointer9 && numPointer12 < numPointer11)
  1451. {
  1452. num = num + (UInt64)(*numPointer6) * (UInt64)(*numPointer13) + (UInt64)(*numPointer12);
  1453. *numPointer12 = (UInt32)num;
  1454. num = num >> 32;
  1455. numPointer13 = numPointer13 + 4;
  1456. numPointer12 = numPointer12 + 4;
  1457. }
  1458. if (num != 0 && numPointer12 < numPointer11)
  1459. {
  1460. *numPointer12 = (UInt32)num;
  1461. }
  1462. }
  1463. numPointer6 = numPointer6 + 4;
  1464. numPointer10 = numPointer10 + 4;
  1465. }
  1466. }
  1467. }
  1468. }
  1469. numPointer4 = null;
  1470. numPointer5 = null;
  1471. }
  1472.  
  1473. public static Void PlusEq(BigInteger bi1, BigInteger bi2)
  1474. {
  1475. unsafe
  1476. {
  1477. UInt32[] numArray;
  1478. UInt32[] numArray1;
  1479. UInt32 num;
  1480. UInt32 num1;
  1481. UInt32 num2;
  1482. UInt32 num3;
  1483. UInt32 num4;
  1484. UInt32 num5 = 0;
  1485. Boolean flag = false;
  1486. if (bi1.length >= bi2.length)
  1487. {
  1488. numArray = bi1.data;
  1489. num1 = bi1.length;
  1490. numArray1 = bi2.data;
  1491. num = bi2.length;
  1492. }
  1493. else
  1494. {
  1495. flag = true;
  1496. numArray = bi2.data;
  1497. num1 = bi2.length;
  1498. numArray1 = bi1.data;
  1499. num = bi1.length;
  1500. }
  1501. UInt32[] numArray2 = bi1.data;
  1502. UInt64 num6 = (UInt64)0;
  1503. do
  1504. {
  1505. num6 = num6 + (UInt64)numArray[num5] + (UInt64)numArray1[num5];
  1506. numArray2[num5] = (UInt32)num6;
  1507. num6 = num6 >> 32;
  1508. num2 = num5 + 1;
  1509. num5 = num2;
  1510. }
  1511. while (num2 < num);
  1512. Boolean flag1 = num6 != (Int64)0;
  1513. if (flag1)
  1514. {
  1515. if (num5 < num1)
  1516. {
  1517. do
  1518. {
  1519. UInt32 num7 = numArray[num5] + 1;
  1520. UInt32 num8 = num7;
  1521. numArray2[num5] = num7;
  1522. flag1 = num8 == 0;
  1523. num4 = num5 + 1;
  1524. num5 = num4;
  1525. }
  1526. while (num4 < num1 && flag1);
  1527. }
  1528. if (flag1)
  1529. {
  1530. numArray2[num5] = 1;
  1531. UInt32 num9 = num5 + 1;
  1532. num5 = num9;
  1533. bi1.length = num9;
  1534. return;
  1535. }
  1536. }
  1537. if (flag && num5 < num1 - 1)
  1538. {
  1539. do
  1540. {
  1541. numArray2[num5] = numArray[num5];
  1542. num3 = num5 + 1;
  1543. num5 = num3;
  1544. }
  1545. while (num3 < num1);
  1546. }
  1547. bi1.length = num1 + 1;
  1548. bi1.Normalize();
  1549. }
  1550. }
  1551.  
  1552. public static BigInteger RightShift(BigInteger bi, Int32 n)
  1553. {
  1554. unsafe
  1555. {
  1556. if (n == 0)
  1557. {
  1558. return new BigInteger(bi);
  1559. }
  1560. Int32 num = n >> 5;
  1561. Int32 num1 = n & 31;
  1562. BigInteger bigInteger = new BigInteger(BigInteger.Sign.Positive, bi.length - num + 1);
  1563. UInt32 length = (UInt32)((Int32)bigInteger.data.Length - 1);
  1564. if (num1 == 0)
  1565. {
  1566. while (true)
  1567. {
  1568. UInt32 num2 = length;
  1569. length = num2 - 1;
  1570. if (num2 <= 0)
  1571. {
  1572. break;
  1573. }
  1574. bigInteger.data[length] = bi.data[checked((IntPtr)((UInt64)length + (Int64)num))];
  1575. }
  1576. }
  1577. else
  1578. {
  1579. UInt32 num3 = 0;
  1580. while (true)
  1581. {
  1582. UInt32 num4 = length;
  1583. length = num4 - 1;
  1584. if (num4 <= 0)
  1585. {
  1586. break;
  1587. }
  1588. UInt32 num5 = bi.data[checked((IntPtr)((UInt64)length + (Int64)num))];
  1589. bigInteger.data[length] = num5 >> (n & 31) | num3;
  1590. num3 = num5 << (32 - n & 31);
  1591. }
  1592. }
  1593. bigInteger.Normalize();
  1594. return bigInteger;
  1595. }
  1596. }
  1597.  
  1598. public static UInt32 SingleByteDivideInPlace(BigInteger n, UInt32 d)
  1599. {
  1600. unsafe
  1601. {
  1602. UInt64 num = (UInt64)0;
  1603. UInt32 num1 = n.length;
  1604. while (true)
  1605. {
  1606. UInt32 num2 = num1;
  1607. num1 = num2 - 1;
  1608. if (num2 <= 0)
  1609. {
  1610. break;
  1611. }
  1612. num = num << 32;
  1613. num = num | (UInt64)n.data[num1];
  1614. n.data[num1] = (UInt32)(num / (UInt64)d);
  1615. num = num % (UInt64)d;
  1616. }
  1617. n.Normalize();
  1618. return (UInt32)num;
  1619. }
  1620. }
  1621.  
  1622. public static unsafe Void SquarePositive(BigInteger bi, ref UInt32[] wkSpace)
  1623. {
  1624.  
  1625. Current member / type: System.Void Mono.Math.BigInteger/Kernel::SquarePositive(Mono.Math.BigInteger,System.UInt32[]&)
  1626. File path: d:\steam\steamapps\common\robocraft\robocraftclient_data\managed\mscorlib.dll
  1627.  
  1628. Product version: 2014.3.1021.0
  1629. Exception in: System.Void SquarePositive(Mono.Math.BigInteger,System.UInt32[]&)
  1630.  
  1631. 未将对象引用设置到对象的实例。
  1632. 在 ™..() 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Ast\Expressions\UnaryExpression.cs:行号 140
  1633. 在 ™..’() 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Ast\Expressions\UnaryExpression.cs:行号 99
  1634. 在 ‚–.†.(TypeReference ‹, Instruction ›) 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Decompiler\ExpressionDecompilerStep.cs:行号 1876
  1635. 在 ‚–.†.(Instruction ›) 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Decompiler\ExpressionDecompilerStep.cs:行号 1969
  1636. 在 .„.‚(Instruction ›,  ƒ) 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Cil\InstructionDispatcher.cs:行号 243
  1637. 在 .€.Visit(Instruction ›) 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Cil\BaseInstructionVisitor.cs:行号 1019
  1638. 在 ‚–.†.‹() 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Decompiler\ExpressionDecompilerStep.cs:行号 126
  1639. 在 ‚–.†.œ(”“ Ž, •Ÿ €–) 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Decompiler\ExpressionDecompilerStep.cs:行号 69
  1640. 在 ‚–.™“.‹(MethodBody €–, ILanguage ) 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Decompiler\DecompilationPipeline.cs:行号 83
  1641. 在 ‚–..›“(™“ œ“, ILanguage , MethodBody €–, ”“& ™) 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Decompiler\Extensions.cs:行号 99
  1642. 在 ‚–..š“(MethodBody €–, ILanguage , ”“& ™,  œ–) 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Decompiler\Extensions.cs:行号 62
  1643. 在 ——.ƒ˜.—(ILanguage , MethodDefinition €,  œ–) 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Decompiler\WriterContextServices\BaseWriterContextService.cs:行号 116
  1644.  
  1645. mailto: JustDecompilePublicFeedback@telerik.com
  1646.  
  1647. }
  1648.  
  1649. public static BigInteger Subtract(BigInteger big, BigInteger small)
  1650. {
  1651. unsafe
  1652. {
  1653. UInt32 num;
  1654. UInt32 num1;
  1655. UInt32 num2;
  1656. BigInteger bigInteger = new BigInteger(BigInteger.Sign.Positive, big.length);
  1657. UInt32[] numArray = bigInteger.data;
  1658. UInt32[] numArray1 = big.data;
  1659. UInt32[] numArray2 = small.data;
  1660. UInt32 num3 = 0;
  1661. UInt32 num4 = 0;
  1662. do
  1663. {
  1664. UInt32 num5 = numArray2[num3];
  1665. UInt32 num6 = num5 + num4;
  1666. num5 = num6;
  1667. UInt32 num7 = numArray1[num3] - num5;
  1668. UInt32 num8 = num7;
  1669. numArray[num3] = num7;
  1670. num4 = (UInt32)((!(num6 < num4 | num8 > ~num5) ? 0 : 1));
  1671. num = num3 + 1;
  1672. num3 = num;
  1673. }
  1674. while (num < small.length);
  1675. if (num3 != big.length)
  1676. {
  1677. if (num4 == 1)
  1678. {
  1679. do
  1680. {
  1681. numArray[num3] = numArray1[num3] - 1;
  1682. num2 = num3;
  1683. num3 = num2 + 1;
  1684. }
  1685. while (numArray1[num2] == 0 && num3 < big.length);
  1686. if (num3 != big.length)
  1687. {
  1688. goto Label1;
  1689. }
  1690. bigInteger.Normalize();
  1691. return bigInteger;
  1692. }
  1693. Label1:
  1694. do
  1695. {
  1696. numArray[num3] = numArray1[num3];
  1697. num1 = num3 + 1;
  1698. num3 = num1;
  1699. }
  1700. while (num1 < big.length);
  1701. }
  1702. bigInteger.Normalize();
  1703. return bigInteger;
  1704. }
  1705. }
  1706. }
  1707.  
  1708. internal sealed class ModulusRing
  1709. {
  1710. private BigInteger mod;
  1711.  
  1712. private BigInteger constant;
  1713.  
  1714. public ModulusRing(BigInteger modulus)
  1715. {
  1716. unsafe
  1717. {
  1718. this.mod = modulus;
  1719. UInt32 num = this.mod.length << 1;
  1720. this.constant = new BigInteger(BigInteger.Sign.Positive, num + 1);
  1721. this.constant.data[num] = 1;
  1722. this.constant = this.constant / this.mod;
  1723. }
  1724. }
  1725.  
  1726. public Void BarrettReduction(BigInteger x)
  1727. {
  1728. unsafe
  1729. {
  1730. BigInteger bigInteger = this.mod;
  1731. UInt32 num = bigInteger.length;
  1732. UInt32 num1 = num + 1;
  1733. UInt32 num2 = num - 1;
  1734. if (x.length < num)
  1735. {
  1736. return;
  1737. }
  1738. if ((Int64)((Int32)x.data.Length) < (UInt64)x.length)
  1739. {
  1740. throw new IndexOutOfRangeException("x out of range");
  1741. }
  1742. BigInteger bigInteger1 = new BigInteger(BigInteger.Sign.Positive, x.length - num2 + this.constant.length);
  1743. BigInteger.Kernel.Multiply(x.data, num2, x.length - num2, this.constant.data, 0, this.constant.length, bigInteger1.data, 0);
  1744. x.length = (x.length <= num1 ? x.length : num1);
  1745. x.Normalize();
  1746. BigInteger bigInteger2 = new BigInteger(BigInteger.Sign.Positive, num1);
  1747. BigInteger.Kernel.MultiplyMod2p32pmod(bigInteger1.data, (Int32)num1, (Int32)(bigInteger1.length - num1), bigInteger.data, 0, (Int32)bigInteger.length, bigInteger2.data, 0, (Int32)num1);
  1748. bigInteger2.Normalize();
  1749. if (bigInteger2 > x)
  1750. {
  1751. BigInteger bigInteger3 = new BigInteger(BigInteger.Sign.Positive, num1 + 1);
  1752. bigInteger3.data[num1] = 1;
  1753. BigInteger.Kernel.MinusEq(bigInteger3, bigInteger2);
  1754. BigInteger.Kernel.PlusEq(x, bigInteger3);
  1755. }
  1756. else
  1757. {
  1758. BigInteger.Kernel.MinusEq(x, bigInteger2);
  1759. }
  1760. while (x >= bigInteger)
  1761. {
  1762. BigInteger.Kernel.MinusEq(x, bigInteger);
  1763. }
  1764. }
  1765. }
  1766.  
  1767. public BigInteger Difference(BigInteger a, BigInteger b)
  1768. {
  1769. BigInteger bigInteger;
  1770. BigInteger.Sign sign = BigInteger.Kernel.Compare(a, b);
  1771. switch (sign)
  1772. {
  1773. case BigInteger.Sign.Negative:
  1774. {
  1775. bigInteger = b - a;
  1776. break;
  1777. }
  1778. case BigInteger.Sign.Zero:
  1779. {
  1780. return 0;
  1781. }
  1782. case BigInteger.Sign.Positive:
  1783. {
  1784. bigInteger = a - b;
  1785. break;
  1786. }
  1787. default:
  1788. {
  1789. throw new Exception();
  1790. }
  1791. }
  1792. if (bigInteger >= this.mod)
  1793. {
  1794. if (bigInteger.length < this.mod.length << 1)
  1795. {
  1796. this.BarrettReduction(bigInteger);
  1797. }
  1798. else
  1799. {
  1800. bigInteger = bigInteger % this.mod;
  1801. }
  1802. }
  1803. if (sign == BigInteger.Sign.Negative)
  1804. {
  1805. bigInteger = this.mod - bigInteger;
  1806. }
  1807. return bigInteger;
  1808. }
  1809.  
  1810. public BigInteger Multiply(BigInteger a, BigInteger b)
  1811. {
  1812. if (a == 0 || b == 0)
  1813. {
  1814. return 0;
  1815. }
  1816. if (a > this.mod)
  1817. {
  1818. a = a % this.mod;
  1819. }
  1820. if (b > this.mod)
  1821. {
  1822. b = b % this.mod;
  1823. }
  1824. BigInteger bigInteger = a * b;
  1825. this.BarrettReduction(bigInteger);
  1826. return bigInteger;
  1827. }
  1828.  
  1829. public BigInteger Pow(BigInteger a, BigInteger k)
  1830. {
  1831. BigInteger bigInteger = new BigInteger(1);
  1832. if (k == 0)
  1833. {
  1834. return bigInteger;
  1835. }
  1836. BigInteger bigInteger1 = a;
  1837. if (k.TestBit(0))
  1838. {
  1839. bigInteger = a;
  1840. }
  1841. for (Int32 i = 1; i < k.BitCount(); i++)
  1842. {
  1843. bigInteger1 = this.Multiply(bigInteger1, bigInteger1);
  1844. if (k.TestBit(i))
  1845. {
  1846. bigInteger = this.Multiply(bigInteger1, bigInteger);
  1847. }
  1848. }
  1849. return bigInteger;
  1850. }
  1851.  
  1852. public BigInteger Pow(UInt32 b, BigInteger exp)
  1853. {
  1854. return this.Pow(new BigInteger(b), exp);
  1855. }
  1856. }
  1857.  
  1858. internal sealed class Montgomery
  1859. {
  1860. private Montgomery()
  1861. {
  1862. }
  1863.  
  1864. public static UInt32 Inverse(UInt32 n)
  1865. {
  1866. UInt32 num = n;
  1867. while (true)
  1868. {
  1869. UInt32 num1 = n * num;
  1870. UInt32 num2 = num1;
  1871. if (num1 == 1)
  1872. {
  1873. break;
  1874. }
  1875. num = num * (2 - num2);
  1876. }
  1877. return (UInt32)(-(UInt64)num);
  1878. }
  1879.  
  1880. public static unsafe BigInteger Reduce(BigInteger n, BigInteger m, UInt32 mPrime)
  1881. {
  1882.  
  1883. Current member / type: Mono.Math.BigInteger Mono.Math.BigInteger/Montgomery::Reduce(Mono.Math.BigInteger,Mono.Math.BigInteger,System.UInt32)
  1884. File path: d:\steam\steamapps\common\robocraft\robocraftclient_data\managed\mscorlib.dll
  1885.  
  1886. Product version: 2014.3.1021.0
  1887. Exception in: Mono.Math.BigInteger Reduce(Mono.Math.BigInteger,Mono.Math.BigInteger,System.UInt32)
  1888.  
  1889. 未将对象引用设置到对象的实例。
  1890. 在 ™..() 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Ast\Expressions\UnaryExpression.cs:行号 140
  1891. 在 ™..’() 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Ast\Expressions\UnaryExpression.cs:行号 99
  1892. 在 ‚–.†.(TypeReference ‹, Instruction ›) 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Decompiler\ExpressionDecompilerStep.cs:行号 1876
  1893. 在 ‚–.†.(Instruction ›) 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Decompiler\ExpressionDecompilerStep.cs:行号 1969
  1894. 在 .„.‚(Instruction ›,  ƒ) 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Cil\InstructionDispatcher.cs:行号 243
  1895. 在 .€.Visit(Instruction ›) 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Cil\BaseInstructionVisitor.cs:行号 1019
  1896. 在 ‚–.†.‹() 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Decompiler\ExpressionDecompilerStep.cs:行号 126
  1897. 在 ‚–.†.œ(”“ Ž, •Ÿ €–) 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Decompiler\ExpressionDecompilerStep.cs:行号 69
  1898. 在 ‚–.™“.‹(MethodBody €–, ILanguage ) 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Decompiler\DecompilationPipeline.cs:行号 83
  1899. 在 ‚–..›“(™“ œ“, ILanguage , MethodBody €–, ”“& ™) 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Decompiler\Extensions.cs:行号 99
  1900. 在 ‚–..š“(MethodBody €–, ILanguage , ”“& ™,  œ–) 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Decompiler\Extensions.cs:行号 62
  1901. 在 ——.ƒ˜.—(ILanguage , MethodDefinition €,  œ–) 位置 c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\Decompiler\Cecil.Decompiler\Decompiler\WriterContextServices\BaseWriterContextService.cs:行号 116
  1902.  
  1903. mailto: JustDecompilePublicFeedback@telerik.com
  1904.  
  1905. }
  1906.  
  1907. public static BigInteger ToMont(BigInteger n, BigInteger m)
  1908. {
  1909. n.Normalize();
  1910. m.Normalize();
  1911. n = n << m.length * 32;
  1912. n = n % m;
  1913. return n;
  1914. }
  1915. }
  1916.  
  1917. public enum Sign
  1918. {
  1919. Negative = -1,
  1920. Zero = 0,
  1921. Positive = 1
  1922. }
  1923. }
  1924. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement