Page MenuHomeSoftware Heritage
Paste P1473

nix recursive hash computation
ActivePublic

Authored by anlambert on Oct 4 2022, 2:09 PM.
{
"outputHash": "0s7p9swjqjsqddylmgid6cv263ggq7pmb734z4k84yfcrgb6kg4g",
"outputHashAlgo": "sha256",
"outputHashMode": "recursive",
"type": "url",
"urls": [
"https://github.com/kandu/trie/archive/1.0.0.tar.gz"
],
"integrity": "sha256-j7xp1svMeYIm+WScVe/B7w0jNjMtvkp9a1hLLLlO92g=",
"inferredFetcher": "fetchzip"
},
anlambert@carnavalet:/tmp$ sudo apt install nix-bin
anlambert@carnavalet:/tmp$ curl -LO https://github.com/kandu/trie/archive/1.0.0.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 2399 0 2399 0 0 8388 0 --:--:-- --:--:-- --:--:-- 8388
anlambert@carnavalet:/tmp$ tar -xvzf 1.0.0.tar.gz
trie-1.0.0/
trie-1.0.0/.gitignore
trie-1.0.0/LICENSE
trie-1.0.0/Makefile
trie-1.0.0/VERSION
trie-1.0.0/dune-project
trie-1.0.0/src/
trie-1.0.0/src/dune
trie-1.0.0/src/trie.ml
trie-1.0.0/src/trie.mli
trie-1.0.0/trie.opam
anlambert@carnavalet:/tmp$ nix-store --dump trie-1.0.0/ | sha256sum
8fbc69d6cbcc798226f9649c55efc1ef0d2336332dbe4a7d6b584b2cb94ef768 -
anlambert@carnavalet:/tmp$ python
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import base64
>>> base64.decodebytes("j7xp1svMeYIm+WScVe/B7w0jNjMtvkp9a1hLLLlO92g=".encode()).hex()
'8fbc69d6cbcc798226f9649c55efc1ef0d2336332dbe4a7d6b584b2cb94ef768'

Event Timeline

$ curl -LO https://github.com/kandu/trie/archive/1.0.0.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  2399    0  2399    0     0   5391      0 --:--:-- --:--:-- --:--:--  5391

$ tar -xvzf 1.0.0.tar.gz
trie-1.0.0/
trie-1.0.0/.gitignore
trie-1.0.0/LICENSE
trie-1.0.0/Makefile
trie-1.0.0/VERSION
trie-1.0.0/dune-project
trie-1.0.0/src/
trie-1.0.0/src/dune
trie-1.0.0/src/trie.ml
trie-1.0.0/src/trie.mli
trie-1.0.0/trie.opam

$ guix hash -S nar -H sha256 -f hex trie-1.0.0/
8fbc69d6cbcc798226f9649c55efc1ef0d2336332dbe4a7d6b584b2cb94ef768

$ guix hash -S nar -H sha256 -f base64 trie-1.0.0/
j7xp1svMeYIm+WScVe/B7w0jNjMtvkp9a1hLLLlO92g=

$ guix hash -S nar -H sha256 -f base64 trie-1.0.0 | base64 -d | hexdump -v -e '/1 "%02x" '
8fbc69d6cbcc798226f9649c55efc1ef0d2336332dbe4a7d6b584b2cb94ef768

$ python3.9 narserializer.py trie-1.0.0/ | sha256sum
8fbc69d6cbcc798226f9649c55efc1ef0d2336332dbe4a7d6b584b2cb94ef768  -

$ python3.9 narserializer.py trie-1.0.0/ sha256
8fbc69d6cbcc798226f9649c55efc1ef0d2336332dbe4a7d6b584b2cb94ef768

$ python3.9 narserializer.py trie-1.0.0/ sha256 base64
j7xp1svMeYIm+WScVe/B7w0jNjMtvkp9a1hLLLlO92g=

where the tiny almost trivial Python code of narserialiser.py reads in T4538.