diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-07-31 15:43:25 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-07-31 15:43:25 +0200 |
commit | 1d0a7b54fa330b041a720932ee4e05dcad1d2d5c (patch) | |
tree | 48627a3530e4d6d58c612864b2e99afb11a0a902 /doc/manual/src/command-ref/nix-hash.md | |
parent | 0c94c176446bd9e9cb8c7e16fb7c6d88bb4e9a20 (diff) |
Enable syntax highlighting
Diffstat (limited to 'doc/manual/src/command-ref/nix-hash.md')
-rw-r--r-- | doc/manual/src/command-ref/nix-hash.md | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/doc/manual/src/command-ref/nix-hash.md b/doc/manual/src/command-ref/nix-hash.md index edb331e1c..d3f91f8e9 100644 --- a/doc/manual/src/command-ref/nix-hash.md +++ b/doc/manual/src/command-ref/nix-hash.md @@ -61,38 +61,44 @@ md5sum`. Computing the same hash as `nix-prefetch-url`: - $ nix-prefetch-url file://<(echo test) - 1lkgqb6fclns49861dwk9rzb6xnfkxbpws74mxnx01z9qyv1pjpj - $ nix-hash --type sha256 --flat --base32 <(echo test) - 1lkgqb6fclns49861dwk9rzb6xnfkxbpws74mxnx01z9qyv1pjpj +```console +$ nix-prefetch-url file://<(echo test) +1lkgqb6fclns49861dwk9rzb6xnfkxbpws74mxnx01z9qyv1pjpj +$ nix-hash --type sha256 --flat --base32 <(echo test) +1lkgqb6fclns49861dwk9rzb6xnfkxbpws74mxnx01z9qyv1pjpj +``` Computing hashes: - $ mkdir test - $ echo "hello" > test/world +```console +$ mkdir test +$ echo "hello" > test/world - $ nix-hash test/ (MD5 hash; default) - 8179d3caeff1869b5ba1744e5a245c04 +$ nix-hash test/ (MD5 hash; default) +8179d3caeff1869b5ba1744e5a245c04 - $ nix-store --dump test/ | md5sum (for comparison) - 8179d3caeff1869b5ba1744e5a245c04 - +$ nix-store --dump test/ | md5sum (for comparison) +8179d3caeff1869b5ba1744e5a245c04 - - $ nix-hash --type sha1 test/ - e4fd8ba5f7bbeaea5ace89fe10255536cd60dab6 +$ nix-hash --type sha1 test/ +e4fd8ba5f7bbeaea5ace89fe10255536cd60dab6 - $ nix-hash --type sha1 --base32 test/ - nvd61k9nalji1zl9rrdfmsmvyyjqpzg4 +$ nix-hash --type sha1 --base32 test/ +nvd61k9nalji1zl9rrdfmsmvyyjqpzg4 - $ nix-hash --type sha256 --flat test/ - error: reading file `test/': Is a directory +$ nix-hash --type sha256 --flat test/ +error: reading file `test/': Is a directory - $ nix-hash --type sha256 --flat test/world - 5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03 +$ nix-hash --type sha256 --flat test/world +5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03 +``` Converting between hexadecimal and base-32: - $ nix-hash --type sha1 --to-base32 e4fd8ba5f7bbeaea5ace89fe10255536cd60dab6 - nvd61k9nalji1zl9rrdfmsmvyyjqpzg4 +```console +$ nix-hash --type sha1 --to-base32 e4fd8ba5f7bbeaea5ace89fe10255536cd60dab6 +nvd61k9nalji1zl9rrdfmsmvyyjqpzg4 - $ nix-hash --type sha1 --to-base16 nvd61k9nalji1zl9rrdfmsmvyyjqpzg4 - e4fd8ba5f7bbeaea5ace89fe10255536cd60dab6 +$ nix-hash --type sha1 --to-base16 nvd61k9nalji1zl9rrdfmsmvyyjqpzg4 +e4fd8ba5f7bbeaea5ace89fe10255536cd60dab6 +``` |