The headless browser for AI agents and web scraping
js: handle SHA-512/224 and SHA-512/256 in crypto.subtle.digest
SGavrldc780d77e409
diff --git a/crates/obscura-js/src/ops.rs b/crates/obscura-js/src/ops.rsindex 1975b72a..99cccd37 100644--- a/crates/obscura-js/src/ops.rs+++ b/crates/obscura-js/src/ops.rs@@ -1067,9 +1067,10 @@ fn op_binding_called(state: &OpState, #[string] name: &str, #[string] payload: &}/// Real WebCrypto `crypto.subtle.digest`. `algorithm` is the SubtleCrypto-/// algorithm name (`SHA-1` / `SHA-256` / `SHA-384` / `SHA-512`); unknown-/// names fall through to SHA-256 to match the previous JS fallback. Returns-/// the raw digest bytes so the JS shim can hand them back as an ArrayBuffer.+/// algorithm name (`SHA-1` / `SHA-256` / `SHA-384` / `SHA-512`, plus the+/// FIPS 180-4 truncated variants `SHA-512/224` and `SHA-512/256`). Other+/// names fall back to SHA-256. Returns the raw digest bytes so the JS shim+/// can hand them back as an ArrayBuffer.#[op2]#[buffer]fn op_subtle_digest(#[string] algorithm: &str, #[buffer] data: &[u8]) -> Vec<u8> {@@ -1080,6 +1081,8 @@ fn op_subtle_digest(#[string] algorithm: &str, #[buffer] data: &[u8]) -> Vec<u8>"SHA-256" => sha2::Sha256::digest(data).to_vec(),"SHA-384" => sha2::Sha384::digest(data).to_vec(),"SHA-512" => sha2::Sha512::digest(data).to_vec(),+ "SHA-512/224" => sha2::Sha512_224::digest(data).to_vec(),+ "SHA-512/256" => sha2::Sha512_256::digest(data).to_vec(),_ => sha2::Sha256::digest(data).to_vec(),}}