SimpleLookupTable.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Math.EC
  5. {
  6. public class SimpleLookupTable
  7. : AbstractECLookupTable
  8. {
  9. private static ECPoint[] Copy(ECPoint[] points, int off, int len)
  10. {
  11. ECPoint[] result = new ECPoint[len];
  12. for (int i = 0; i < len; ++i)
  13. {
  14. result[i] = points[off + i];
  15. }
  16. return result;
  17. }
  18. private readonly ECPoint[] points;
  19. public SimpleLookupTable(ECPoint[] points, int off, int len)
  20. {
  21. this.points = Copy(points, off, len);
  22. }
  23. public override int Size
  24. {
  25. get { return points.Length; }
  26. }
  27. public override ECPoint Lookup(int index)
  28. {
  29. throw new NotSupportedException("Constant-time lookup not supported");
  30. }
  31. public override ECPoint LookupVar(int index)
  32. {
  33. return points[index];
  34. }
  35. }
  36. }
  37. #pragma warning restore
  38. #endif