aria-bsv-hasher 0.5.1

Canonical JSON serialization and SHA-256 hashing for ARIA BRC-121
Documentation

aria-bsv-hasher — Canonical JSON serialization and SHA-256 hashing.

Implements the ARIA BRC-121 canonical JSON format, which is identical to the Python SDK's canonical_json(): object keys are sorted lexicographically, arrays preserve order, and output is UTF-8 bytes with no whitespace.

Example

use aria_bsv_hasher::{hash_object, hash_bytes, prefixed_hash};
use serde_json::json;

let h = hash_object(&json!({"b": 2, "a": 1})).unwrap();
assert_eq!(h.len(), 64);  // lowercase hex SHA-256

// Same result as: hash_bytes(b"{\"a\":1,\"b\":2}")
let direct = hash_bytes(b"{\"a\":1,\"b\":2}");
assert_eq!(h, direct);

assert_eq!(prefixed_hash(&h), format!("sha256:{}", h));