Secp192k1.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <?php
  2. /******************************************************************************
  3. * This file is part of the Phactor PHP project. You can always find the latest
  4. * version of this class and project at: https://github.com/ionux/phactor
  5. *
  6. * Copyright (c) 2015-2018 Rich Morgan, rich@richmorgan.me
  7. *
  8. * The MIT License (MIT)
  9. *
  10. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  11. * this software and associated documentation files (the "Software"), to deal in
  12. * the Software without restriction, including without limitation the rights to
  13. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  14. * the Software, and to permit persons to whom the Software is furnished to do so,
  15. * subject to the following conditions:
  16. *
  17. * The above copyright notice and this permission notice shall be included in all
  18. * copies or substantial portions of the Software.
  19. *
  20. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  22. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  23. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  24. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  25. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26. ******************************************************************************/
  27. namespace Phactor;
  28. /**
  29. * This trait specifies the recommended 192-bit elliptic curve domain
  30. * parameters over Fp associated with the Koblitz curve secp192k1.
  31. * @see http://www.secg.org/sec2-v2.pdf
  32. *
  33. * @author Rich Morgan <rich@richmorgan.me>
  34. */
  35. trait Secp192k1
  36. {
  37. /*
  38. * The elliptic curve domain parameters over Fp associated with a Koblitz curve secp192k1 are
  39. * specified by the sextuple T = (p, a, b, G, n, h) where the finite field Fp is defined by:
  40. */
  41. /**
  42. * The base point G in uncompressed form in hex:
  43. *
  44. * @var string
  45. */
  46. public $G = '04db4ff10ec057e9ae26b07d0280b7f4341da5d1b1eae06c7d9b2f2f6d9c5628a7844163d015be86344082aa88d95e2f9d';
  47. /**
  48. * 2^192 − 2^32 − 2^12 − 2^8 − 2^7 − 2^6 − 2^3 − 1 in hex:
  49. *
  50. * @var string
  51. */
  52. public $p_hex = '0xfffffffffffffffffffffffffffffffffffffffeffffee37';
  53. /**
  54. * 2^192 − 2^32 − 2^12 − 2^8 − 2^7 − 2^6 − 2^3 − 1 in decimal:
  55. *
  56. * @var string
  57. */
  58. public $p = '6277101735386680763835789423207666416102355444459739541047';
  59. /**
  60. * The curve E: y^2 = x^3 + ax + b over Fp, where a in hex:
  61. *
  62. * @var string
  63. */
  64. public $a_hex = '0x00';
  65. /**
  66. * The curve E: y^2 = x^3 + ax + b over Fp, where a in decimal:
  67. *
  68. * @var string
  69. */
  70. public $a = '0';
  71. /**
  72. * The curve E: y^2 = x^3 + ax + b over Fp, where b in hex:
  73. *
  74. * @var string
  75. */
  76. public $b_hex = '0x03';
  77. /**
  78. * The curve E: y^2 = x^3 + ax + b over Fp, where b in decimal:
  79. *
  80. * @var string
  81. */
  82. public $b = '3';
  83. /**
  84. * The order n of G in hex:
  85. *
  86. * @var string
  87. */
  88. public $n_hex = '0xfffffffffffffffffffffffe26f2fc170f69466a74defd8d';
  89. /**
  90. * The order n of G in decimal:
  91. *
  92. * @var string
  93. */
  94. public $n = '6277101735386680763835789423061264271957123915200845512077';
  95. /**
  96. * The cofactor in hex:
  97. *
  98. * @var string
  99. */
  100. public $h_hex = '0x01';
  101. /**
  102. * The cofactor in decimal:
  103. *
  104. * @var string
  105. */
  106. public $h = '1';
  107. /**
  108. * X-coordinate of G in hex:
  109. *
  110. * @var string
  111. */
  112. public $Gx_hex = '0xdb4ff10ec057e9ae26b07d0280b7f4341da5d1b1eae06c7d';
  113. /**
  114. * X-coordinate of G in decimal:
  115. *
  116. * @var string
  117. */
  118. public $Gx = '5377521262291226325198505011805525673063229037935769709693';
  119. /**
  120. * Y-coordinate of G in hex:
  121. *
  122. * @var string
  123. */
  124. public $Gy_hex = '0x9b2f2f6d9c5628a7844163d015be86344082aa88d95e2f9d';
  125. /**
  126. * Y-coordinate of G in decimal:
  127. *
  128. * @var string
  129. */
  130. public $Gy = '3805108391982600717572440947423858335415441070543209377693';
  131. }