The `blake3: ` content hash of a JSON value's canonical form.
(value: &Value)
| 14 | |
| 15 | /// The `blake3:<hex>` content hash of a JSON value's canonical form. |
| 16 | pub fn content_hash(value: &Value) -> String { |
| 17 | let canonical = jcs::canonicalize(value); |
| 18 | let digest = blake3::hash(canonical.as_bytes()); |
| 19 | format!("blake3:{}", digest.to_hex()) |
| 20 | } |
| 21 | |
| 22 | #[cfg(test)] |
| 23 | mod tests { |
no test coverage detected