@@ -25,7 +25,7 @@ use core::cmp::Reverse;
25
25
#[ cfg( feature = "std" ) ]
26
26
use std:: error;
27
27
28
- use crate :: hashes:: { sha256, sha256t , Hash , HashEngine } ;
28
+ use crate :: hashes:: { sha256, Hash , HashEngine } ;
29
29
use crate :: schnorr:: { TweakedPublicKey , UntweakedPublicKey , TapTweak } ;
30
30
use crate :: util:: key:: XOnlyPublicKey ;
31
31
use crate :: Script ;
@@ -60,41 +60,17 @@ const MIDSTATE_TAPSIGHASH: [u8; 32] = [
60
60
] ;
61
61
// f504a425d7f8783b1363868ae3e556586eee945dbc7888dd02a6e2c31873fe9f
62
62
63
- /// Internal macro to speficy the different taproot tagged hashes.
64
- macro_rules! sha256t_hash_newtype {
65
- ( $newtype: ident, $tag: ident, $midstate: ident, $midstate_len: expr, $docs: meta, $reverse: expr) => {
66
- sha256t_hash_newtype!( $newtype, $tag, $midstate, $midstate_len, $docs, $reverse, stringify!( $newtype) ) ;
67
- } ;
68
-
69
- ( $newtype: ident, $tag: ident, $midstate: ident, $midstate_len: expr, $docs: meta, $reverse: expr, $sname: expr) => {
70
- #[ doc = "The tag used for [" ]
71
- #[ doc = $sname]
72
- #[ doc = "]" ]
73
- #[ derive( Copy , Clone , PartialEq , Eq , Default , PartialOrd , Ord , Hash ) ]
74
- pub struct $tag;
75
-
76
- impl sha256t:: Tag for $tag {
77
- fn engine( ) -> sha256:: HashEngine {
78
- let midstate = sha256:: Midstate :: from_inner( $midstate) ;
79
- sha256:: HashEngine :: from_midstate( midstate, $midstate_len)
80
- }
81
- }
82
-
83
- hash_newtype!( $newtype, sha256t:: Hash <$tag>, 32 , $docs, $reverse) ;
84
- } ;
85
- }
86
-
87
63
// Taproot test vectors from BIP-341 state the hashes without any reversing
88
- sha256t_hash_newtype ! ( TapLeafHash , TapLeafTag , MIDSTATE_TAPLEAF , 64 ,
64
+ hashes :: sha256t_hash_newtype!( TapLeafHash , TapLeafTag , MIDSTATE_TAPLEAF , 64 ,
89
65
doc="Taproot-tagged hash for tapscript Merkle tree leafs" , false
90
66
) ;
91
- sha256t_hash_newtype ! ( TapBranchHash , TapBranchTag , MIDSTATE_TAPBRANCH , 64 ,
67
+ hashes :: sha256t_hash_newtype!( TapBranchHash , TapBranchTag , MIDSTATE_TAPBRANCH , 64 ,
92
68
doc="Taproot-tagged hash for tapscript Merkle tree branches" , false
93
69
) ;
94
- sha256t_hash_newtype ! ( TapTweakHash , TapTweakTag , MIDSTATE_TAPTWEAK , 64 ,
70
+ hashes :: sha256t_hash_newtype!( TapTweakHash , TapTweakTag , MIDSTATE_TAPTWEAK , 64 ,
95
71
doc="Taproot-tagged hash for public key tweaks" , false
96
72
) ;
97
- sha256t_hash_newtype ! ( TapSighashHash , TapSighashTag , MIDSTATE_TAPSIGHASH , 64 ,
73
+ hashes :: sha256t_hash_newtype!( TapSighashHash , TapSighashTag , MIDSTATE_TAPSIGHASH , 64 ,
98
74
doc="Taproot-tagged hash for the taproot signature hash" , false
99
75
) ;
100
76
0 commit comments