PrimeField.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. using System;
  3. namespace Org.BouncyCastle.Math.Field
  4. {
  5. internal class PrimeField
  6. : IFiniteField
  7. {
  8. protected readonly BigInteger characteristic;
  9. internal PrimeField(BigInteger characteristic)
  10. {
  11. this.characteristic = characteristic;
  12. }
  13. public virtual BigInteger Characteristic
  14. {
  15. get { return characteristic; }
  16. }
  17. public virtual int Dimension
  18. {
  19. get { return 1; }
  20. }
  21. public override bool Equals(object obj)
  22. {
  23. if (this == obj)
  24. {
  25. return true;
  26. }
  27. PrimeField other = obj as PrimeField;
  28. if (null == other)
  29. {
  30. return false;
  31. }
  32. return characteristic.Equals(other.characteristic);
  33. }
  34. public override int GetHashCode()
  35. {
  36. return characteristic.GetHashCode();
  37. }
  38. }
  39. }
  40. #endif