W3C compliant subresource integrity implementation https://www.w3.org/TR/SRI/
Go to file
2024-10-06 03:00:17 -05:00
src serde feature and support 2024-10-06 03:00:17 -05:00
.gitignore initial commit 2024-10-05 18:00:26 -05:00
Cargo.lock serde feature and support 2024-10-06 03:00:17 -05:00
Cargo.toml serde feature and support 2024-10-06 03:00:17 -05:00
README.md extra newline removed 2024-10-06 01:16:44 -05:00

Subresource Integrity

This library accepts an integrity attribute value which can be used to verify the integrity of a fetched resource.

Supported Algorithms

Only the algorithms required in the specification are supported. Those algorithms are SHA-256, SHA-384, and SHA-512. These hashing algorithms are provided by the sha2 crate.

Usage

let value = "sha384-H8BRh8j48O9oYatfu5AZzq6A9RINhZO5H16dQZngK7T62em8MUt1FLm52t+eX6xO";
let integrity = Integrity::try_from(integrity_value).unwrap();
integrity.verify("alert(\'Hello, world.\');"); // true