SimpleLookupTable.cs 942 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. : ECLookupTable
  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 virtual int Size
  24. {
  25. get { return points.Length; }
  26. }
  27. public virtual ECPoint Lookup(int index)
  28. {
  29. return points[index];
  30. }
  31. }
  32. }
  33. #pragma warning restore
  34. #endif