feat(tvix/eval): implement builtins.hashString

Implements md5, sha1, sha256 and sha512 using the related crates from
the RustCrypto hashes project (https://github.com/RustCrypto/hashes)

Change-Id: I00730dea44ec9ef85309edc27addab0ae88814b8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11005
Tested-by: BuildkiteCI
Reviewed-by: aspen <root@gws.fyi>
This commit is contained in:
Padraic-O-Mhuiris 2024-02-21 16:49:07 +00:00 committed by Pádraic Ó Mhuiris
parent ffb134398d
commit 5c3065b43a
14 changed files with 263 additions and 11 deletions

View file

@ -1,4 +1,4 @@
with import ./../lib.nix;
with import ./lib.nix;
builtins.groupBy (n:
builtins.substring 0 1 (builtins.hashString "sha256" (toString n))

View file

@ -0,0 +1 @@
[ "8a0614b4eaa4cffb7515ec101847e198" "8bd218cf61321d8aa05b3602b99f90d2d8cef3d6" "80ac06d74cb6c5d14af718ce8c3c1255969a1a595b76a3cf92354a95331a879a" "0edac513b6b0454705b553deda4c9b055da0939d26d2f73548862817ebeac5378cf64ff7a752ce1a0590a736735d3bbd9e8a7f04d93617cdf514313f5ab5baa4" ]

View file

@ -0,0 +1,6 @@
[
(builtins.hashString "md5" "tvix")
(builtins.hashString "sha1" "tvix")
(builtins.hashString "sha256" "tvix")
(builtins.hashString "sha512" "tvix")
]