Skip to content

Commit 6620ee3

Browse files
committed
Merge remote-tracking branch 'benma/utf8'
2 parents 6ab1c83 + 1d950ad commit 6620ee3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/rust/bitbox02-rust/src/workflow/pairing.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ use alloc::string::String;
2121
pub fn format_hash(hash: &[u8; 32]) -> String {
2222
let mut encoded = [0u8; 60];
2323
let encoded = binascii::b32encode(&hash[..], &mut encoded).unwrap();
24-
// Base32 contains only utf-8 valid chars. unwrap is safe
25-
let encoded = core::str::from_utf8(encoded).expect("invalid utf-8");
24+
// Base32 contains only utf-8 valid chars.
25+
let encoded = unsafe { core::str::from_utf8_unchecked(encoded) };
2626
format!(
2727
"{} {}\n{} {}",
2828
&encoded[0..5],

0 commit comments

Comments
 (0)