mirror of
https://github.com/NixOS/nix.git
synced 2024-11-26 16:52:27 +00:00
3f192ac80c
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.
5 lines
154 B
Nix
5 lines
154 B
Nix
let
|
|
strings = [ "" "text 1" "text 2" ];
|
|
in
|
|
builtins.concatLists (map (hash: map (builtins.hashString hash) strings) ["md5" "sha1" "sha256" "sha512"])
|