sigildocs

(sigil store hash)

Exports

hash-fileprocedure

Compute the SHA-256 hash of a file's contents.

Returns a hex-encoded hash string.

(hash-file "/path/to/file.sgl")
; => "a3f7c8..."
hash-dataprocedure

Compute the SHA-256 hash of a string or bytevector.

(hash-data "hello world")
; => "b94d27..."

Compute a deterministic hash of a directory tree.

The directory is serialized deterministically (sorted entries, no permissions/timestamps/ownership) before hashing. This produces identical hashes regardless of filesystem, OS, or timestamps.

(hash-directory "/path/to/dir")
; => "d91e2a..."
truncate-hashprocedure

Truncate a hex hash string to N characters.

Used to create store path prefixes (32 hex chars = 128 bits).

(truncate-hash "abcdef0123456789..." 32)
; => "abcdef01234567890123456789012345"