OpenForm
CLICommands

hash

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

ArgumentDescription
fileFile to compute hash for, or - for stdin

Options

OptionDescription
--jsonOutput 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.pdf

Output:

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 -

See also

  • fix - Auto-compute checksums for all layers in an artifact
  • attach - Attach files to artifacts as layers

On this page