mirror of
https://github.com/NixOS/nix
synced 2025-07-08 02:43:54 +02:00
Add builtins.hashFile
For text files it is possible to do it like so: `builtins.hashString "sha256" (builtins.readFile /tmp/a)` but that doesn't work for binary files. With builtins.hashFile any kind of file can be conveniently hashed.
This commit is contained in:
parent
f9a2ea4486
commit
3f192ac80c
9 changed files with 39 additions and 1 deletions
4
tests/lang/eval-okay-hashstring.nix
Normal file
4
tests/lang/eval-okay-hashstring.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
let
|
||||
strings = [ "" "text 1" "text 2" ];
|
||||
in
|
||||
builtins.concatLists (map (hash: map (builtins.hashString hash) strings) ["md5" "sha1" "sha256" "sha512"])
|
Loading…
Add table
Add a link
Reference in a new issue