Skip to content

Decode and Info Commands ​

These two commands work on a hash you already have. decode shows what a hash looks like, and info explains what is stored in it. Both take the hash as an argument, or - to read it from standard input. Installing and the global options are described on Encode Command.

decode ​

Rebuilds the blurred preview from a hash. Without --output the preview is drawn in the terminal with coloured half-blocks, so a colour terminal is needed. With --output it is saved as an image, and that needs sharp.

bash
hazehash decode <hash> [options]

Example — see a hash in the terminal:

bash
hazehash decode Ed7UwRWKKv5znm6a7sC1tziHDNpMuCikxrYpIg

Example — save it as an image:

bash
hazehash decode Ed7UwRWKKv5znm6a7sC1tziHDNpMuCikxrYpIg -o preview.png --scale 8
text
✔ saved preview.png 256×200 px from a 32×25 preview

Options ​

-o, --output <file> ​

Saves the preview as an image instead of drawing it in the terminal. The format follows the extension: .png, .webp or .jpg.

-s, --size <px> ​

The long side of the decoded preview, 4–128. Default 32.

--scale <n> ​

With --output, enlarges the saved image n times with smooth interpolation, 1–32. Default 8. A preview is only a few dozen pixels, so a saved file at scale 1 is tiny.

bash
hazehash decode Ed7UwRWKKv5znm6a7sC1tziHDNpMuCikxrYpIg -o p2.webp -s 64 --scale 4
text
✔ saved p2.webp 256×196 px from a 64×49 preview

--no-dither ​

Turns off the deterministic dithering that hides banding.

A value that is not a hash ​

bash
hazehash decode zzz
text
✖ this is not a HazeHash: its length is not valid (a hash has at least 10 characters)

The command exits with code 1.

info ​

Reads only the header of a hash and explains it: the size, the aspect ratio, how many frequency components are stored for brightness and colour, the average colour and whether transparency is included.

bash
hazehash info <hash> [options]

Example:

bash
hazehash info Ef90QP3dAP7_773v3y-6uqjYQIqBEaRAVVEpEA
text
HazeHash info

  Hash            Ef90QP3dAP7_773v3y-6uqjYQIqBEaRAVVEpEA
  Size            28 bytes                38 characters in base64url; header 7 B + data 21 B
  Format          version 1               the only version so far
  Aspect ratio    13:10 (1.30)            placeholder is drawn 32×25 at 32 px; page layout should use the real image size
  Transparency    none                    the preview is opaque
  Brightness grid 8×8                     frequency components across × down; more means finer structure
  Colour grid     3×4                     colour needs fewer components than brightness
  Coefficients    79 stored               detail values after the header; a cut hash simply keeps fewer
  Average colour  #8c898e                 OKLab L 0.63, a 0.01, b -0.01
  Entropy coding  Rice k = 0, 0, 0        bits per value group for L, a, b (and alpha)

Options ​

--json ​

Prints the same facts as JSON, for scripts.

bash
hazehash info Ed7UwRWKKv5znm6a7sC1tziHDNpMuCikxrYpIg --json
json
{
  "hash": "Ed7UwRWKKv5znm6a7sC1tziHDNpMuCikxrYpIg",
  "characters": 38,
  "bytes": 28,
  "headerBytes": 7,
  "dataBytes": 21,
  "version": 1,
  "aspectRatio": 1.2968,
  "nearestRatio": "13:10",
  "alpha": false,
  "lumaGrid": [6, 8],
  "chromaGrid": [2, 3],
  "alphaGrid": null,
  "storedCoefficients": 54,
  "averageColor": "#988e7e",
  "averageOklab": [0.651, 0.005, 0.025],
  "riceParameters": [1, 1, 1],
  "scaleCodes": [11, 1, 4]
}

lumaGrid and chromaGrid are the numbers of frequency components across and down for brightness and for the two colour channels. alphaGrid is null for a hash without transparency. storedCoefficients counts the detail values after the header, and riceParameters and scaleCodes describe how each channel is quantised and coded; see Hash Format.