Skip to content

Instantly share code, notes, and snippets.

@paul-d-ray
Created December 3, 2025 00:31
Show Gist options
  • Select an option

  • Save paul-d-ray/e7f9fbac8fd7e58d64ead77e19557fd7 to your computer and use it in GitHub Desktop.

Select an option

Save paul-d-ray/e7f9fbac8fd7e58d64ead77e19557fd7 to your computer and use it in GitHub Desktop.
Nushell Get SHA256 Hash for a list of files

Purpose

Get the SHA256 Hast for a list of files. This can be used to compare to the hast of a downloaded file.

Nushell Code

nuls -f d:/work/tools | where name =~ '^nu'| sort-by modified | select fullname |
each {|file| {fullname: $file.fullname, hash: (open $file.fullname --raw | hash sha256)} } | collect

Sample Output

╭───┬─────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────╮
│ # │                      fullname                       │                               hash                               │
├───┼─────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────┤
│ 0 │ d:\work\tools\nu-0.106.1-x86_64-pc-windows-msvc.msi │ b4a219b2787f860567c7307d0f67d020e1eb4e68cf0b0007091c4d8e9a5ea87a │
│ 1 │ d:\work\tools\nu-0.107.0-x86_64-pc-windows-msvc.msi │ f72b4d6d43593a896fc1de5a5f27146bbcd5fe3510bc0b1a877e1ab79d73ba24 │
│ 2 │ d:\work\tools\nu-0.108.0-x86_64-pc-windows-msvc.msi │ 1fc8bedef78483ee2aff70cb763f2776cdef16276d9e76453d32ead152b58358 │
│ 3 │ d:\work\tools\nu-0.109.0-x86_64-pc-windows-msvc.msi │ 8cdfbcfd0310a43f5dac42f69c7c3d7f3a1b52e65c3a3a50fc83f1f5853d9c63 │
│ 4 │ d:\work\tools\nu-0.109.1-x86_64-pc-windows-msvc.msi │ 633571ecf8f20761069d9298ac83a45af745dddc3472bba1d7b66022b3cb4941 │
╰───┴─────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────╯
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment