ElGamalPublicKeyParameters.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. using System;
  3. using Org.BouncyCastle.Math;
  4. namespace Org.BouncyCastle.Crypto.Parameters
  5. {
  6. public class ElGamalPublicKeyParameters
  7. : ElGamalKeyParameters
  8. {
  9. private readonly BigInteger y;
  10. public ElGamalPublicKeyParameters(
  11. BigInteger y,
  12. ElGamalParameters parameters)
  13. : base(false, parameters)
  14. {
  15. if (y == null)
  16. throw new ArgumentNullException("y");
  17. this.y = y;
  18. }
  19. public BigInteger Y
  20. {
  21. get { return y; }
  22. }
  23. public override bool Equals(
  24. object obj)
  25. {
  26. if (obj == this)
  27. return true;
  28. ElGamalPublicKeyParameters other = obj as ElGamalPublicKeyParameters;
  29. if (other == null)
  30. return false;
  31. return Equals(other);
  32. }
  33. protected bool Equals(
  34. ElGamalPublicKeyParameters other)
  35. {
  36. return y.Equals(other.y) && base.Equals(other);
  37. }
  38. public override int GetHashCode()
  39. {
  40. return y.GetHashCode() ^ base.GetHashCode();
  41. }
  42. }
  43. }
  44. #endif