diff --git a/VERSION b/VERSION index 659914ae..416bfb0a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.8 +0.5.9 diff --git a/nostr_core/cashu_mint.c b/nostr_core/cashu_mint.c index 3f0bd372..d37a1c4f 100644 --- a/nostr_core/cashu_mint.c +++ b/nostr_core/cashu_mint.c @@ -1797,14 +1797,15 @@ static int cashu_hash_to_curve_pubkey(const char* secret, nostr_secp256k1_pubkey } unsigned char candidate[33] = {0}; - for (int counter = 0; counter < 1024; counter++) { + for (int counter = 0; counter < 65536; counter++) { unsigned char h[32] = {0}; - unsigned char data[36] = {0}; - memcpy(data, digest, 32); - data[32] = (unsigned char)((counter >> 24) & 0xff); - data[33] = (unsigned char)((counter >> 16) & 0xff); + unsigned char data[37] = {0}; + data[0] = 0x02; + memcpy(data + 1, digest, 32); + data[33] = (unsigned char)(counter & 0xff); data[34] = (unsigned char)((counter >> 8) & 0xff); - data[35] = (unsigned char)(counter & 0xff); + data[35] = (unsigned char)((counter >> 16) & 0xff); + data[36] = (unsigned char)((counter >> 24) & 0xff); if (nostr_sha256(data, sizeof(data), h) != 0) { return NOSTR_ERROR_CRYPTO_FAILED; } @@ -1814,11 +1815,6 @@ static int cashu_hash_to_curve_pubkey(const char* secret, nostr_secp256k1_pubkey if (nostr_secp256k1_ec_pubkey_parse(out_y, candidate, sizeof(candidate))) { return NOSTR_SUCCESS; } - - candidate[0] = 0x03; - if (nostr_secp256k1_ec_pubkey_parse(out_y, candidate, sizeof(candidate))) { - return NOSTR_SUCCESS; - } } return NOSTR_ERROR_CRYPTO_FAILED; diff --git a/nostr_core/nostr_core.h b/nostr_core/nostr_core.h index a6d6c5ed..91d42793 100644 --- a/nostr_core/nostr_core.h +++ b/nostr_core/nostr_core.h @@ -2,10 +2,10 @@ #define NOSTR_CORE_H // Version information (auto-updated by increment_and_push.sh) -#define VERSION "v0.5.8" +#define VERSION "v0.5.9" #define VERSION_MAJOR 0 #define VERSION_MINOR 5 -#define VERSION_PATCH 8 +#define VERSION_PATCH 9 /* * NOSTR Core Library - Complete API Reference diff --git a/tests/nip60_live_receive_test b/tests/nip60_live_receive_test index 4a7e5800..c539e694 100755 Binary files a/tests/nip60_live_receive_test and b/tests/nip60_live_receive_test differ diff --git a/tests/nip60_live_receive_test.c b/tests/nip60_live_receive_test.c index d21e0f7d..418257f7 100644 --- a/tests/nip60_live_receive_test.c +++ b/tests/nip60_live_receive_test.c @@ -36,14 +36,15 @@ static int secret_to_Y_hex(const char* secret, char out_Y_hex[67]) { } unsigned char candidate[33] = {0}; - for (int counter = 0; counter < 1024; counter++) { + for (int counter = 0; counter < 65536; counter++) { unsigned char h[32] = {0}; - unsigned char data[36] = {0}; - memcpy(data, digest, 32); - data[32] = (unsigned char)((counter >> 24) & 0xff); - data[33] = (unsigned char)((counter >> 16) & 0xff); + unsigned char data[37] = {0}; + data[0] = 0x02; + memcpy(data + 1, digest, 32); + data[33] = (unsigned char)(counter & 0xff); data[34] = (unsigned char)((counter >> 8) & 0xff); - data[35] = (unsigned char)(counter & 0xff); + data[35] = (unsigned char)((counter >> 16) & 0xff); + data[36] = (unsigned char)((counter >> 24) & 0xff); if (nostr_sha256(data, sizeof(data), h) != 0) { return NOSTR_ERROR_CRYPTO_FAILED; @@ -57,12 +58,6 @@ static int secret_to_Y_hex(const char* secret, char out_Y_hex[67]) { nostr_bytes_to_hex(candidate, sizeof(candidate), out_Y_hex); return NOSTR_SUCCESS; } - - candidate[0] = 0x03; - if (nostr_secp256k1_ec_pubkey_parse(&pub, candidate, sizeof(candidate))) { - nostr_bytes_to_hex(candidate, sizeof(candidate), out_Y_hex); - return NOSTR_SUCCESS; - } } return NOSTR_ERROR_CRYPTO_FAILED;