blob: 13ef571650f761c20d0a466e041c5d018aa52907 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
using System;
using Org.BouncyCastle.Utilities;
namespace Org.BouncyCastle.Math.Field
{
internal class GenericPolynomialExtensionField
: IPolynomialExtensionField
{
protected readonly IFiniteField subfield;
protected readonly IPolynomial minimalPolynomial;
internal GenericPolynomialExtensionField(IFiniteField subfield, IPolynomial polynomial)
{
this.subfield = subfield;
this.minimalPolynomial = polynomial;
}
public virtual BigInteger Characteristic
{
get { return subfield.Characteristic; }
}
public virtual int Dimension
{
get { return subfield.Dimension * minimalPolynomial.Degree; }
}
public virtual IFiniteField Subfield
{
get { return subfield; }
}
public virtual int Degree
{
get { return minimalPolynomial.Degree; }
}
public virtual IPolynomial MinimalPolynomial
{
get { return minimalPolynomial; }
}
public override bool Equals(object obj)
{
if (this == obj)
{
return true;
}
GenericPolynomialExtensionField other = obj as GenericPolynomialExtensionField;
if (null == other)
{
return false;
}
return subfield.Equals(other.subfield) && minimalPolynomial.Equals(other.minimalPolynomial);
}
public override int GetHashCode()
{
return subfield.GetHashCode() ^ Integers.RotateLeft(minimalPolynomial.GetHashCode(), 16);
}
}
}
|