Nix Hash: Difference between revisions
added BLAKE3 to the list of supported algorithms |
replace link with more permanent version |
||
Line 4: | Line 4: | ||
Supported algorithms are <code>md5</code>, <code>sha1</code>, <code>sha256</code>, <code>sha512</code>, <code>BLAKE3</code>. The first two are deprecated and should not be used anymore, but you may still stumble upon them in existing code. | Supported algorithms are <code>md5</code>, <code>sha1</code>, <code>sha256</code>, <code>sha512</code>, <code>BLAKE3</code>. The first two are deprecated and should not be used anymore, but you may still stumble upon them in existing code. | ||
A hash – which is simply a sequence of bytes – is usually encoded in order to be representable as string. Common encodings are <code>base16</code> (commonly called "hex"), <code>base32</code> and <code>base64</code>. Note that the base32 is a [https://github.com/NixOS/nix/blob/ | A hash – which is simply a sequence of bytes – is usually encoded in order to be representable as string. Common encodings are <code>base16</code> (commonly called "hex"), <code>base32</code> and <code>base64</code>. Note that the base32 is a [https://github.com/NixOS/nix/blob/c70e1433abb61012dffdcd4559ec2aa87672e15c/src/libutil/hash.cc#L91-L112 '''custom one'''] that is not documented nor standardized in any way! If possible, use the provided hashing tools to convert hashes to it (see below). base32 is used by Nix in a lot of places because it is shorter than hex but can still safely be part of a file path (as it contains no slashes). | ||
== Usage == | == Usage == |