← Files Biological Sequence & Alignment ViewerARCHIVED FILE
src/artifact-state-key.ts
400 Bytes · Sep 30, 2026 · 23:01 UTC
/** Stable, content-sensitive key used to reset viewer-local interaction state. */
export function createArtifactStateKey(
contents: string,
fileName: string | undefined,
): string {
let hash = 5_381;
for (let index = 0; index < contents.length; index += 1) {
hash = (hash * 33 + contents.charCodeAt(index)) % 2_147_483_647;
}
return `${fileName ?? ""}:${contents.length}:${hash}`;
}
SHA-256: 4fcc37d7653ecab276ba449b8605adc4a4677b27999bcdee833cf9d2371f5f72