@@ -9,19 +9,18 @@ pub fn get_mint_to_public_content_hash(owner: AztecAddress, amount: Field) -> Fi
9
9
let recipient_bytes :[u8 ; 32 ] = owner .to_field ().to_be_bytes ();
10
10
let amount_bytes :[u8 ; 32 ] = amount .to_be_bytes ();
11
11
12
- for i in 0 ..32 {
13
- hash_bytes [i + 4 ] = recipient_bytes [i ];
14
- hash_bytes [i + 36 ] = amount_bytes [i ];
15
- }
16
-
17
12
// The purpose of including the following selector is to make the message unique to that specific call. Note that
18
13
// it has nothing to do with calling the function.
19
14
let selector = comptime { std::hash:: keccak256 ("mint_to_public(bytes32,uint256)" .as_bytes (), 31 ) };
20
15
21
- hash_bytes [0 ] = selector [0 ];
22
- hash_bytes [1 ] = selector [1 ];
23
- hash_bytes [2 ] = selector [2 ];
24
- hash_bytes [3 ] = selector [3 ];
16
+ for i in 0 ..4 {
17
+ hash_bytes [i ] = selector [i ];
18
+ }
19
+
20
+ for i in 0 ..32 {
21
+ hash_bytes [i + 4 ] = recipient_bytes [i ];
22
+ hash_bytes [i + 36 ] = amount_bytes [i ];
23
+ }
25
24
26
25
let content_hash = sha256_to_field (hash_bytes );
27
26
content_hash
@@ -37,18 +36,17 @@ pub fn get_mint_to_private_content_hash(
37
36
let mut hash_bytes = [0 ; 36 ];
38
37
let amount_bytes :[u8 ; 32 ] = amount .to_be_bytes ();
39
38
40
- for i in 0 ..32 {
41
- hash_bytes [i + 4 ] = amount_bytes [i ];
42
- }
43
-
44
39
// The purpose of including the following selector is to make the message unique to that specific call. Note that
45
40
// it has nothing to do with calling the function.
46
41
let selector = comptime { std::hash:: keccak256 ("mint_to_private(uint256)" .as_bytes (), 24 ) };
47
42
48
- hash_bytes [0 ] = selector [0 ];
49
- hash_bytes [1 ] = selector [1 ];
50
- hash_bytes [2 ] = selector [2 ];
51
- hash_bytes [3 ] = selector [3 ];
43
+ for i in 0 ..4 {
44
+ hash_bytes [i ] = selector [i ];
45
+ }
46
+
47
+ for i in 0 ..32 {
48
+ hash_bytes [i + 4 ] = amount_bytes [i ];
49
+ }
52
50
53
51
let content_hash = sha256_to_field (hash_bytes );
54
52
content_hash
@@ -71,10 +69,9 @@ pub fn get_withdraw_content_hash(recipient: EthAddress, amount: Field, caller_on
71
69
// it has nothing to do with calling the function.
72
70
let selector = comptime { std::hash:: keccak256 ("withdraw(address,uint256,address)" .as_bytes (), 33 ) };
73
71
74
- hash_bytes [0 ] = selector [0 ];
75
- hash_bytes [1 ] = selector [1 ];
76
- hash_bytes [2 ] = selector [2 ];
77
- hash_bytes [3 ] = selector [3 ];
72
+ for i in 0 ..4 {
73
+ hash_bytes [i ] = selector [i ];
74
+ }
78
75
79
76
for i in 0 ..32 {
80
77
hash_bytes [i + 4 ] = recipient_bytes [i ];
0 commit comments