nist256p1.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 =*/{0x1fffffff, 0x1fffffff, 0x1fffffff, 0x000001ff,
  26. 0x00000000, 0x00000000, 0x00040000, 0x1fe00000,
  27. 0xffffff}},
  28. /* G */
  29. {/*.x =*/{/*.val =*/{0x1898c296, 0x0509ca2e, 0x1acce83d, 0x06fb025b,
  30. 0x040f2770, 0x1372b1d2, 0x091fe2f3, 0x1e5c2588,
  31. 0x6b17d1}},
  32. /*.y =*/{/*.val =*/{0x17bf51f5, 0x1db20341, 0x0c57b3b2, 0x1c66aed6,
  33. 0x19e162bc, 0x15a53e07, 0x1e6e3b9f, 0x1c5fc34f,
  34. 0x4fe342}}},
  35. /* order */
  36. {/*.val =*/{0x1c632551, 0x1dce5617, 0x05e7a13c, 0x0df55b4e, 0x1ffffbce,
  37. 0x1fffffff, 0x0003ffff, 0x1fe00000, 0xffffff}},
  38. /* order_half */
  39. {/*.val =*/{0x1e3192a8, 0x0ee72b0b, 0x02f3d09e, 0x06faada7, 0x1ffffde7,
  40. 0x1fffffff, 0x0001ffff, 0x1ff00000, 0x7fffff}},
  41. /* a */ -3,
  42. /* b */
  43. {/*.val =*/{0x07d2604b, 0x1e71e1f1, 0x14ec3d8e, 0x1a0d6198, 0x086bc651,
  44. 0x1eaabb4c, 0x0f9ecfae, 0x1b154752, 0x005ac635}}
  45. #if USE_PRECOMPUTED_CP
  46. ,
  47. /* cp */
  48. {
  49. #include "nist256p1.table"
  50. }
  51. #endif
  52. };
  53. const curve_info nist256p1_info = {
  54. .bip32_name = "Nist256p1 seed",
  55. .params = &nist256p1,
  56. .hasher_base58 = HASHER_SHA2D,
  57. .hasher_sign = HASHER_SHA2D,
  58. .hasher_pubkey = HASHER_SHA2_RIPEMD,
  59. .hasher_script = HASHER_SHA2,
  60. };