2
2
3
3
use serde:: { Deserialize , Serialize } ;
4
4
5
+ use crate :: fmt:: HexDebug ;
6
+
5
7
/// Nullifier seed, named rho in the [spec][ps].
6
8
///
7
9
/// [ps]: https://zips.z.cash/protocol/protocol.pdf#sproutkeycomponents
@@ -11,23 +13,23 @@ use serde::{Deserialize, Serialize};
11
13
any( test, feature = "proptest-impl" ) ,
12
14
derive( proptest_derive:: Arbitrary )
13
15
) ]
14
- pub struct NullifierSeed ( pub ( crate ) [ u8 ; 32 ] ) ;
16
+ pub struct NullifierSeed ( pub ( crate ) HexDebug < [ u8 ; 32 ] > ) ;
15
17
16
18
impl AsRef < [ u8 ] > for NullifierSeed {
17
19
fn as_ref ( & self ) -> & [ u8 ] {
18
- & self . 0
20
+ self . 0 . as_ref ( )
19
21
}
20
22
}
21
23
22
24
impl From < [ u8 ; 32 ] > for NullifierSeed {
23
25
fn from ( bytes : [ u8 ; 32 ] ) -> Self {
24
- Self ( bytes)
26
+ Self ( bytes. into ( ) )
25
27
}
26
28
}
27
29
28
30
impl From < NullifierSeed > for [ u8 ; 32 ] {
29
31
fn from ( rho : NullifierSeed ) -> Self {
30
- rho. 0
32
+ * rho. 0
31
33
}
32
34
}
33
35
@@ -37,22 +39,22 @@ impl From<NullifierSeed> for [u8; 32] {
37
39
any( test, feature = "proptest-impl" ) ,
38
40
derive( proptest_derive:: Arbitrary )
39
41
) ]
40
- pub struct Nullifier ( pub [ u8 ; 32 ] ) ;
42
+ pub struct Nullifier ( pub HexDebug < [ u8 ; 32 ] > ) ;
41
43
42
44
impl From < [ u8 ; 32 ] > for Nullifier {
43
45
fn from ( bytes : [ u8 ; 32 ] ) -> Self {
44
- Self ( bytes)
46
+ Self ( bytes. into ( ) )
45
47
}
46
48
}
47
49
48
50
impl From < Nullifier > for [ u8 ; 32 ] {
49
51
fn from ( n : Nullifier ) -> Self {
50
- n. 0
52
+ * n. 0
51
53
}
52
54
}
53
55
54
56
impl From < & Nullifier > for [ u8 ; 32 ] {
55
57
fn from ( n : & Nullifier ) -> Self {
56
- n. 0
58
+ * n. 0
57
59
}
58
60
}
0 commit comments