stateHashOf

tcmts.store.stateHashOf · #rbi4qvbg · term · runs on the server

uses node:crypto

import { createHash } from "node:crypto";

export function stateHashOf(rows: { path: string; hash: string }[]): string {
  const lines = rows.map((r) => `${r.path} ${r.hash}\n`).sort();
  return createHash("sha256").update(lines.join("")).digest("hex").slice(0, 32);
}

used by