Skip to content

Commit 75caf24

Browse files
committed
tests: add sha256 tag test
Test midstate tags used in silent payments.
1 parent 758af6b commit 75caf24

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/modules/silentpayments/tests_impl.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,25 @@ void run_silentpayments_test_vector_receive(const struct bip352_test_vector *tes
668668
}
669669
}
670670

671+
static void silentpayments_sha256_tag_test(void) {
672+
secp256k1_sha256 sha;
673+
{
674+
unsigned char tag[] = "BIP0352/Inputs";
675+
secp256k1_silentpayments_sha256_init_inputs(&sha);
676+
sha256_tag_test_internal(&sha, tag, sizeof(tag) - 1);
677+
}
678+
{
679+
unsigned char tag[] = "BIP0352/SharedSecret";
680+
secp256k1_silentpayments_sha256_init_sharedsecret(&sha);
681+
sha256_tag_test_internal(&sha, tag, sizeof(tag) - 1);
682+
}
683+
{
684+
unsigned char tag[] = "BIP0352/Label";
685+
secp256k1_silentpayments_sha256_init_label(&sha);
686+
sha256_tag_test_internal(&sha, tag, sizeof(tag) - 1);
687+
}
688+
}
689+
671690
void run_silentpayments_test_vectors(void) {
672691
size_t i;
673692

@@ -685,6 +704,7 @@ void run_silentpayments_tests(void) {
685704
test_label_api();
686705
test_recipient_api();
687706
run_silentpayments_test_vectors();
707+
silentpayments_sha256_tag_test();
688708
}
689709

690710
#endif

0 commit comments

Comments
 (0)