nist256p1.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /**
  2. * Copyright (c) 2013-2014 Tomas Dzetkulic
  3. * Copyright (c) 2013-2014 Pavol Rusnak
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining
  6. * a copy of this software and associated documentation files (the "Software"),
  7. * to deal in the Software without restriction, including without limitation
  8. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  9. * and/or sell copies of the Software, and to permit persons to whom the
  10. * Software is furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included
  13. * in all copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  16. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
  19. * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  20. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  21. * OTHER DEALINGS IN THE SOFTWARE.
  22. */
  23. #include "nist256p1.h"
  24. const ecdsa_curve nist256p1 = {
  25. /* .prime */ {/*.val =*/{
  26. 0x1fffffff,
  27. 0x1fffffff,
  28. 0x1fffffff,
  29. 0x000001ff,
  30. 0x00000000,
  31. 0x00000000,
  32. 0x00040000,
  33. 0x1fe00000,
  34. 0xffffff}},
  35. /* G */
  36. {/*.x =*/{/*.val =*/{
  37. 0x1898c296,
  38. 0x0509ca2e,
  39. 0x1acce83d,
  40. 0x06fb025b,
  41. 0x040f2770,
  42. 0x1372b1d2,
  43. 0x091fe2f3,
  44. 0x1e5c2588,
  45. 0x6b17d1}},
  46. /*.y =*/{/*.val =*/{
  47. 0x17bf51f5,
  48. 0x1db20341,
  49. 0x0c57b3b2,
  50. 0x1c66aed6,
  51. 0x19e162bc,
  52. 0x15a53e07,
  53. 0x1e6e3b9f,
  54. 0x1c5fc34f,
  55. 0x4fe342}}},
  56. /* order */
  57. {/*.val =*/{
  58. 0x1c632551,
  59. 0x1dce5617,
  60. 0x05e7a13c,
  61. 0x0df55b4e,
  62. 0x1ffffbce,
  63. 0x1fffffff,
  64. 0x0003ffff,
  65. 0x1fe00000,
  66. 0xffffff}},
  67. /* order_half */
  68. {/*.val =*/{
  69. 0x1e3192a8,
  70. 0x0ee72b0b,
  71. 0x02f3d09e,
  72. 0x06faada7,
  73. 0x1ffffde7,
  74. 0x1fffffff,
  75. 0x0001ffff,
  76. 0x1ff00000,
  77. 0x7fffff}},
  78. /* a */ -3,
  79. /* b */
  80. {/*.val =*/{
  81. 0x07d2604b,
  82. 0x1e71e1f1,
  83. 0x14ec3d8e,
  84. 0x1a0d6198,
  85. 0x086bc651,
  86. 0x1eaabb4c,
  87. 0x0f9ecfae,
  88. 0x1b154752,
  89. 0x005ac635}}
  90. #if USE_PRECOMPUTED_CP
  91. ,
  92. /* cp */
  93. {
  94. #include "nist256p1.table"
  95. }
  96. #endif
  97. };
  98. const curve_info nist256p1_info = {
  99. .bip32_name = "Nist256p1 seed",
  100. .params = &nist256p1,
  101. .hasher_base58 = HASHER_SHA2D,
  102. .hasher_sign = HASHER_SHA2D,
  103. .hasher_pubkey = HASHER_SHA2_RIPEMD,
  104. .hasher_script = HASHER_SHA2,
  105. };