Home Explore Blog CI



nushell

commands/docs/hash_sha256.md
5d428d5a8225be43a99a9ee6ec1d44bec8bba7997dbfa49500000003000005c0
---
title: hash sha256
categories: |
  hash
version: 0.104.0
hash: |
  Hash a value using the sha256 hash algorithm.
usage: |
  Hash a value using the sha256 hash algorithm.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `hash sha256` for [hash](/commands/categories/hash.md)

<div class='command-title'>Hash a value using the sha256 hash algorithm.</div>

## 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 |
| ------ | ------ |
| binary | any    |
| record | record |
| string | any    |
| table  | table  |
## Examples

Return the sha256 hash of a string, hex-encoded
```nu
> 'abcdefghijklmnopqrstuvwxyz' | hash sha256
71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73
```

Return the sha256 hash of a string, as binary
```nu
> 'abcdefghijklmnopqrstuvwxyz' | hash sha256 --binary
Length: 32 (0x20) bytes | 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 a file's contents
```nu
> open ./nu_0_24_1_windows.zip | hash sha256

```

Chunks
4f5106c5 (1st chunk of `commands/docs/hash_sha256.md`)
Title: hash sha256: Calculate SHA256 Hash
Summary
The `hash sha256` command calculates the SHA256 hash of a given input. It supports strings, binaries, records, and tables as input. The output can be either a hexadecimal representation (default) or a binary representation (using the `--binary` flag). It can also be used to hash the contents of a file.