-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
40 additions
and
303 deletions.
There are no files selected for viewing
3 changes: 1 addition & 2 deletions
3
noir-projects/aztec-nr/aztec/src/encrypted_logs/encrypted_event_emission.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
pub fn arr_to_be_bytes_arr<let L: u32>(fields: [Field; L]) -> [u8; L * 32] { | ||
let mut bytes = [0 as u8; L * 32]; | ||
for i in 0..L { | ||
// Note that bytes.append() results in bound error | ||
let to_add: [u8; 32] = fields[i].to_be_bytes(); | ||
for j in 0..32 { | ||
bytes[i * 32 + j] = to_add[j]; | ||
} | ||
} | ||
bytes | ||
} | ||
|
||
// each character of a string is converted into a byte | ||
// then an ACVM field via the oracle => we recreate here | ||
pub fn str_to_be_bytes_arr<let L: u32>(string: str<L>) -> [u8; L * 32] { | ||
let chars_bytes: [u8; L] = string.as_bytes(); | ||
let mut bytes = [0 as u8; L * 32]; | ||
for i in 0..L { | ||
let to_add: [u8; 32] = (chars_bytes[i] as Field).to_be_bytes(); | ||
for j in 0..32 { | ||
bytes[i * 32 + j] = to_add[j]; | ||
} | ||
} | ||
bytes | ||
} |
Oops, something went wrong.