680 B
680 B
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