Subresource Integrity Hash Generator
Hash explicit UTF-8 text with SHA-256, SHA-384, or SHA-512 and emit Base64 Subresource Integrity metadata.
Description
Subresource Integrity metadata combines a hash algorithm with a Base64 digest of resource bytes.
When to use Subresource Integrity Hash Generator
Use this tool to hash explicit UTF-8 text with SHA-256, SHA-384, or SHA-512 and emit Base64 Subresource Integrity metadata.
Choose the URL, decoded source text, header value or explicit byte list requested by this tool. Paste the complete relevant input and follow its parsing and encoding conventions.
How to use Subresource Integrity Hash Generator and understand its results
- Choose the URL, decoded source text, header value or explicit byte list requested by this tool. Paste the complete relevant input and follow its parsing and encoding conventions.
- Enter text, algorithm using the field table and calculation rules, then run the tool.
- Read integrity. The explanation below defines the units, signs, ordering and any flags or placeholder values.
- If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
| Input field | Meaning | Value type; see rules below | Requirement |
|---|---|---|---|
| text | Resource content interpreted as UTF-8 text. | string; maximum length: 1000000 | Required |
| algorithm | SRI hash algorithm. | string; one of "sha256", "sha384", "sha512" | Required |
Paste the complete resource text and choose sha256, sha384 or sha512. The tool encodes the text as UTF-8, hashes it and emits one integrity token. Whitespace and line endings are not normalized.
integrity=algorithm+'-'+Base64(SHA(UTF8(text))) Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.
| Output field | Meaning | Value type |
|---|---|---|
| integrity | Algorithm and Base64 digest. | string; maximum length: 1000000 |
{
"input": {
"text": "abc",
"algorithm": "sha256"
},
"output": {
"integrity": "sha256-ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0="
}
} Limitations and assumptions
The tool hashes text rather than an arbitrary binary file and does not fetch a resource. It does not verify an existing digest, browser CORS conditions or the safety of the resource's behavior.
Numeric inputs must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Extremely large text inputs are rejected. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors.
Alternative or Complementary methods
Use Integrity Attribute Parser: Split integrity metadata into supported SHA algorithm tokens, digest text, and options, reporting unsupported or malformed tokens separately. For a complementary task, use ModulepreloadDetector: Extract modulepreload link hints from HTML source without fetching, validating browser support, or resolving their hrefs.
Further background: Subresource Integrity.
References
-
Subresource Integrity Hash Generator — tool.io
-
Subresource Integrity — W3C
Similar or alternative tools
- Integrity Attribute Parser
Split integrity metadata into supported SHA algorithm tokens, digest text, and options, reporting unsupported or malformed tokens separately.
- ModulepreloadDetector
Extract modulepreload link hints from HTML source without fetching, validating browser support, or resolving their hrefs.