hash sha256

For hash.

Hash a value using the sha256 hash algorithm.

Command Type

built-in

Signature

> hash sha256 {flags} ...rest

Flags

  • --binary, -b: Output binary instead of hexadecimal representation.

Parameters

  • ...rest: Optionally sha256 hash data by cell path.

Input/output types:

input output
string oneof<string, binary>
binary oneof<string, binary>
list<string> list<oneof<string, binary>>
list<binary> list<oneof<string, binary>>
table table
record record

Examples

Return the sha256 hash of a string, hex-encoded

> 'abcdefghijklmnopqrstuvwxyz' | hash sha256
71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73

Return the sha256 hash of a string, as binary

> 'abcdefghijklmnopqrstuvwxyz' | hash sha256 --binary
Length: 32 (0x20) bytes | null_char printable whitespace ascii_other non_ascii
00000000:   71 c4 80 df  93 d6 ae 2f  1e fa d1 44  7c 66 c9 52   q××××××/•××D|f×R
00000010:   5e 31 62 18  cf 51 fc 8d  9e d8 32 f2  da f1 8b 73   ^1b•×Q××××2××××s

Return the sha256 hash of binary data

> 0x[deadbeef] | hash sha256

Return the sha256 hash of a file’s contents

> open ./nu_0_24_1_windows.zip | hash sha256

Return the sha256 hash of a list of strings

> [abc def ghi] | hash sha256
╭───┬──────────────────────────────────────────────────────────────────╮
│ 0 │ ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad │
│ 1 │ cb8379ac2098aa165029e3938a51da0bcecfc008fd6795f401178647f96c5b34 │
│ 2 │ 50ae61e841fac4e8f9e40baf2ad36ec868922ea48368c18f9535e47db56dd7fb │
╰───┴──────────────────────────────────────────────────────────────────╯

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.