crypto: add NUMS_H const

This commit is contained in:
josibake
2024-02-13 17:41:59 +01:00
parent 2cedb42a92
commit b946f8a4c5
4 changed files with 26 additions and 0 deletions

View File

@@ -13,6 +13,7 @@
#include <secp256k1_schnorrsig.h>
#include <span.h>
#include <uint256.h>
#include <util/strencodings.h>
#include <algorithm>
#include <cassert>
@@ -181,6 +182,17 @@ int ecdsa_signature_parse_der_lax(secp256k1_ecdsa_signature* sig, const unsigned
return 1;
}
/** Nothing Up My Sleeve (NUMS) point
*
* NUMS_H is a point with an unknown discrete logarithm, constructed by taking the sha256 of 'g'
* (uncompressed encoding), which happens to be a point on the curve.
*
* For an example script for calculating H, refer to the unit tests in
* ./test/functional/test_framework/crypto/secp256k1.py
*/
static const std::vector<unsigned char> NUMS_H_DATA{ParseHex("50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0")};
const XOnlyPubKey XOnlyPubKey::NUMS_H{NUMS_H_DATA};
XOnlyPubKey::XOnlyPubKey(Span<const unsigned char> bytes)
{
assert(bytes.size() == 32);