dev: reduce build sizes (especially debug)

This commit is contained in:
2026-03-24 23:48:33 +01:00
parent 7a4876b0e8
commit 60f81f6d4e
2 changed files with 37 additions and 0 deletions

View File

@@ -10,8 +10,19 @@ keywords = ["oauth", "oauth2", "oidc", "OpenID"]
categories = ["web-programming::http-server", "authentication"] categories = ["web-programming::http-server", "authentication"]
[profile.release] [profile.release]
lto = true
strip = "symbols" # almost half of binary size smh strip = "symbols" # almost half of binary size smh
# so I don't need "full" just yet and the debug builds are HUGE
[profile.dev]
debug = 1
[profile.dev.package.actix-web]
opt-level = 3
debug = false
[profile.dev.package.tokio]
opt-level = 3
debug = false
[features] [features]
default = ["pamsock"] default = ["pamsock"]
pamsock = ["dep:pamsock"] pamsock = ["dep:pamsock"]

View File

@@ -37,3 +37,29 @@ pub mod web {
} }
} }
} }
pub mod shasum {
#[must_use]
pub fn sha256sum_to_hex_string(sha256sum: &[u8]) -> String {
let mut out = String::with_capacity(sha256sum.len() * 2);
for &b in sha256sum {
/// Only correct as long as `n` is ranged within a nibble
#[inline]
const fn nibble_to_hex(n: u8) -> char {
(match n {
0..=9 => b'0' + n,
_ => b'a' + (n - 10),
}) as char
}
let hi = (b >> 4) & 0x0f;
let lo = b & 0x0f;
out.push(nibble_to_hex(hi));
out.push(nibble_to_hex(lo));
}
out
}
}