@@ -128,12 +128,36 @@ static void test_bulletproofs_pp_tagged_hash(void) {
128128 secp256k1_sha256 sha_cached ;
129129 unsigned char output [32 ];
130130 unsigned char output_cached [32 ];
131+ secp256k1_scalar s ;
131132
132133 secp256k1_sha256_initialize_tagged (& sha , tag_data , sizeof (tag_data ));
133134 secp256k1_bulletproofs_pp_sha256_tagged_commitment_init (& sha_cached );
134135 secp256k1_sha256_finalize (& sha , output );
135136 secp256k1_sha256_finalize (& sha_cached , output_cached );
136137 CHECK (secp256k1_memcmp_var (output , output_cached , 32 ) == 0 );
138+
139+ {
140+ unsigned char expected [32 ] = { 0x21 , 0x2F , 0xB6 , 0x4F , 0x9D , 0x8C , 0x3B , 0xC5 ,
141+ 0xF6 , 0x91 , 0x15 , 0xEE , 0x74 , 0xF5 , 0x12 , 0x67 ,
142+ 0x8A , 0x41 , 0xC6 , 0x85 , 0x1A , 0x79 , 0x14 , 0xFC ,
143+ 0x48 , 0x15 , 0xC7 , 0x2D , 0xF8 , 0x63 , 0x8F , 0x1B };
144+ secp256k1_bulletproofs_pp_sha256_tagged_commitment_init (& sha );
145+ secp256k1_bulletproofs_challenge_scalar (& s , & sha , 0 );
146+ secp256k1_scalar_get_b32 (output , & s );
147+ CHECK (memcmp (output , expected , sizeof (output )) == 0 );
148+ }
149+
150+ {
151+ unsigned char tmp [3 ] = {0 , 1 , 2 };
152+ unsigned char expected [32 ] = { 0x8D , 0xAA , 0xB7 , 0x7E , 0x3C , 0x6A , 0x9E , 0xEC ,
153+ 0x72 , 0x7E , 0x3E , 0xB7 , 0x10 , 0x03 , 0xF0 , 0xE9 ,
154+ 0x69 , 0x4D , 0xAA , 0x96 , 0xCE , 0x98 , 0xBB , 0x39 ,
155+ 0x1C , 0x2F , 0x7C , 0x2E , 0x1C , 0x17 , 0x78 , 0x6D };
156+ secp256k1_sha256_write (& sha , tmp , sizeof (tmp ));
157+ secp256k1_bulletproofs_challenge_scalar (& s , & sha , 0 );
158+ secp256k1_scalar_get_b32 (output , & s );
159+ CHECK (memcmp (output , expected , sizeof (output )) == 0 );
160+ }
137161}
138162
139163void test_log_exp (void ) {
0 commit comments