평문 환경 숙의 연습 해시 보정

This commit is contained in:
Yun Chan 2026-08-09 19:38:04 +09:00
parent 21461ab323
commit ba5e6326d5
9 changed files with 262 additions and 14 deletions

View file

@ -20,6 +20,7 @@ import {
} from "./deliberatePracticeApi";
import "./deliberate-practice.css";
import { randomUuid } from "../../lib/uuid";
import { sha256Hex } from "../../lib/sha256";
interface PracticeTurn {
id: string;
@ -195,14 +196,7 @@ function splitCounterevidence(value: string): string[] {
async function phraseFingerprint(phrase: string): Promise<string> {
const normalized = phrase.normalize("NFKC").trim().replace(/\s+/g, " ");
const digest = await crypto.subtle.digest(
"SHA-256",
new TextEncoder().encode(normalized),
);
const hex = Array.from(new Uint8Array(digest), (byte) =>
byte.toString(16).padStart(2, "0"),
).join("");
return `utterance-sha256:${hex}`;
return `utterance-sha256:${await sha256Hex(normalized)}`;
}
function turnForEvidence(