mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 14:32:42 +01:00
Fix #14532. As discussed on the call today: 1. We'll stick with `format = "base16"` and `hash = "<hash>"`, not do `base16 = "<hash>"`, in order to be forward compatible with supporting more versioning formats. The motivation we discussed for someday *possibly* doing this is making it easier to write very slap-dash lang2nix tools that create (not consume) derivations with dynamic derivations. 2. We will remove support for non-base16 (and make that the default, not base64) in `Hash`, so this is strictly forward contingency, *not* yet something we support. (And also not something we have concrete plans to start supporting.)
50 lines
1.6 KiB
YAML
50 lines
1.6 KiB
YAML
"$schema": "http://json-schema.org/draft-04/schema"
|
|
"$id": "https://nix.dev/manual/nix/latest/protocols/json/schema/hash-v1.json"
|
|
title: Hash
|
|
description: |
|
|
A cryptographic hash value used throughout Nix for content addressing and integrity verification.
|
|
|
|
This schema describes the JSON representation of Nix's `Hash` type.
|
|
type: object
|
|
properties:
|
|
algorithm:
|
|
"$ref": "#/$defs/algorithm"
|
|
format:
|
|
type: string
|
|
enum:
|
|
- base16
|
|
title: Hash format
|
|
description: |
|
|
The encoding format of the hash value.
|
|
|
|
`base16` (lowercase hexadecimal) is the only format that is currently supported for JSON serialization.
|
|
This field exists primarily to reduce ambiguity about what the hash means.
|
|
It would also help us support other formats in the future, but there are no concrete plans to do so at this.
|
|
hash:
|
|
type: string
|
|
title: Hash
|
|
description: |
|
|
The encoded hash value, itself.
|
|
|
|
It is specified in the format specified by the `format` field.
|
|
It must be the right length for the hash algorithm specified in the `algorithm` field, also.
|
|
The hash value does not include any algorithm prefix.
|
|
required:
|
|
- algorithm
|
|
- format
|
|
- hash
|
|
additionalProperties: false
|
|
"$defs":
|
|
algorithm:
|
|
type: string
|
|
enum:
|
|
- blake3
|
|
- md5
|
|
- sha1
|
|
- sha256
|
|
- sha512
|
|
title: Hash algorithm
|
|
description: |
|
|
The hash algorithm used to compute the hash value.
|
|
|
|
`blake3` is currently experimental and requires the [`blake-hashing`](@docroot@/development/experimental-features.md#xp-feature-blake3-hashes) experimental feature.
|