From 5ad8443c8d6d9ed3f9d28ac52af529ceb41d741f Mon Sep 17 00:00:00 2001 From: Vika Date: Wed, 1 Jan 2025 05:42:45 +0300 Subject: Get rid of base64 and hex in favor of data_encoding crate Less dependency duplication = more fun Change-Id: Icbd0497a68fdd5bea3757e3c62c80008b87bce96 --- src/login.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/login.rs') diff --git a/src/login.rs b/src/login.rs index 646c832..19bfaf7 100644 --- a/src/login.rs +++ b/src/login.rs @@ -332,7 +332,13 @@ async fn client_metadata( digest.update(b" "); digest.update(crate::OAUTH2_SOFTWARE_ID.as_bytes()); - let etag = String::from("W/") + &hex::encode(digest.finalize()); + let etag = { + let mut etag = String::with_capacity(66); + etag.push_str("W/"); + data_encoding::HEXLOWER.encode_append(&digest.finalize(), &mut etag); + + etag + }; axum_extra::headers::ETag::from_str(&etag).unwrap() }; if let Some(cached) = cached { -- cgit 1.4.1