From 7eb00e0f560154c9e7b68f34aef62aa101d74b0e Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Mon, 13 May 2024 15:52:18 +0200 Subject: [PATCH] refactor: use libpt for joining the base64 parser vec #5 #13 --- src/format.rs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/format.rs b/src/format.rs index a2fced6..bccfdc4 100644 --- a/src/format.rs +++ b/src/format.rs @@ -306,18 +306,7 @@ where None => s, }; match fast32::base64::RFC4648.decode_str(s) { - Ok(r) => { - if r.len() > 16 { - panic!("boom"); - } - let mut ri: u128 = 0; - for (i, e) in r.iter().rev().enumerate() { - ri += (*e as u128) * 256.pow(i as u32) as u128; - } - dbg!(ri); - dbg!(format!("{ri:#x}")); - Ok(ri.to_string().parse().unwrap()) - } + Ok(r) => Ok(join::array_to_unsigned::(&r)?), Err(e) => { let e = format!("{e}"); Err(anyhow!(e))