CLICommands
hashLast updated on
Last updated on
Compute file checksums
Compute a SHA256 checksum of a file, formatted for use in layer definitions.
Usage
ofm hash <file> [options]Arguments
| Argument | Description |
|---|---|
file | File to compute hash for, or - for stdin |
Options
| Option | Description |
|---|---|
--json | Output as JSON |
-a, --algorithm <algorithm> | Hash algorithm (default: sha256) |
Description
Computes the SHA256 checksum of a file and outputs it in the sha256:<hex> format used by OpenForm layer definitions. This is useful when manually adding file-backed layers to artifacts.
Examples
Hash a PDF file:
ofm hash lease-template.pdfOutput:
sha256:a3f2b8c4e5d6...JSON output:
ofm hash lease-template.pdf --json{
"checksum": "sha256:a3f2b8c4e5d6...",
"algorithm": "sha256",
"hash": "a3f2b8c4e5d6...",
"path": "lease-template.pdf"
}Hash from stdin:
cat file.pdf | ofm hash -