# < Summary

Information

Class: | Renci.SshNet.Security.Org.BouncyCastle.Math.Field.FiniteFields
Assembly: | Renci.SshNet
File(s): | \home\appveyor\projects\ssh-net\src\Renci.SshNet\Security\BouncyCastle\math\field\FiniteFields.cs

Line coverage
22%

Covered lines: | 6
Uncovered lines: | 21
Coverable lines: | 27
Total lines: | 54
Line coverage: | 22.2%

Branch coverage
18%

Covered branches: | 3
Total branches: | 16
Branch coverage: | 18.7%

Method coverage

Feature is only available for sponsors

Upgrade to PRO version

# Metrics

Method | Branch coverage | Cyclomatic complexity | Line coverage
--- | --- | --- | ---
.cctor() | 100% | 1 | 0%
GetBinaryExtensionField(...) | 0% | 6 | 0%
GetPrimeField(...) | 30% | 10 | 46.15%

# File(s)

## \home\appveyor\projects\ssh-net\src\Renci.SshNet\Security\BouncyCastle\math\field\FiniteFields.cs

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `using System;`
|  | `2` |  | ``
|  | `3` |  | `namespace Renci.SshNet.Security.Org.BouncyCastle.Math.Field`
|  | `4` |  | `{`
|  | `5` |  | `internal abstract class FiniteFields`
|  | `6` |  | `{`
| 0 | `7` |  | `internal static readonly IFiniteField GF_2 = new PrimeField(BigInteger.ValueOf(2));`
| 0 | `8` |  | `internal static readonly IFiniteField GF_3 = new PrimeField(BigInteger.ValueOf(3));`
|  | `9` |  | ``
|  | `10` |  | `public static IPolynomialExtensionField GetBinaryExtensionField(int[] exponents)`
| 0 | `11` |  | `{`
| 0 | `12` |  | `if (exponents[0] != 0)`
| 0 | `13` |  | `{`
| 0 | `14` |  | `throw new ArgumentException("Irreducible polynomials in GF(2) must have constant term", "exponents");`
|  | `15` |  | `}`
| 0 | `16` |  | `for (int i = 1; i < exponents.Length; ++i)`
| 0 | `17` |  | `{`
| 0 | `18` |  | `if (exponents[i] <= exponents[i - 1])`
| 0 | `19` |  | `{`
| 0 | `20` |  | `throw new ArgumentException("Polynomial exponents must be montonically increasing", "exponents");`
|  | `21` |  | `}`
| 0 | `22` |  | `}`
|  | `23` |  | ``
| 0 | `24` |  | `return new GenericPolynomialExtensionField(GF_2, new GF2Polynomial(exponents));`
| 0 | `25` |  | `}`
|  | `26` |  | ``
|  | `27` |  | `// public static IPolynomialExtensionField GetTernaryExtensionField(Term[] terms)`
|  | `28` |  | `// {`
|  | `29` |  | `// return new GenericPolynomialExtensionField(GF_3, new GF3Polynomial(terms));`
|  | `30` |  | `// }`
|  | `31` |  | ``
|  | `32` |  | `public static IFiniteField GetPrimeField(BigInteger characteristic)`
| 3 | `33` |  | `{`
| 3 | `34` |  | `int bitLength = characteristic.BitLength;`
| 3 | `35` |  | `if (characteristic.SignValue <= 0 || bitLength < 2)`
| 0 | `36` |  | `{`
| 0 | `37` |  | `throw new ArgumentException("Must be >= 2", "characteristic");`
|  | `38` |  | `}`
|  | `39` |  | ``
| 3 | `40` |  | `if (bitLength < 3)`
| 0 | `41` |  | `{`
| 0 | `42` |  | `switch (characteristic.IntValue)`
|  | `43` |  | `{`
|  | `44` |  | `case 2:`
| 0 | `45` |  | `return GF_2;`
|  | `46` |  | `case 3:`
| 0 | `47` |  | `return GF_3;`
|  | `48` |  | `}`
| 0 | `49` |  | `}`
|  | `50` |  | ``
| 3 | `51` |  | `return new PrimeField(characteristic);`
| 3 | `52` |  | `}`
|  | `53` |  | `}`
|  | `54` |  | `}`

# Methods/Properties

.cctor()
GetBinaryExtensionField(System.Int32[])
GetPrimeField(Renci.SshNet.Security.Org.BouncyCastle.Math.BigInteger)