From 4b4ad548267e6c033afd7d52be0fcbc048299653 Mon Sep 17 00:00:00 2001 From: Ethan Soh Date: Thu, 4 Jun 2026 11:18:11 +0800 Subject: [PATCH 1/2] feat: add FIPS-202 SHA3-256 to Bulk Evidence Hash Reporter (#2) - New "SHA3-256 (FIPS 202)" column computed per file, plus PDF and Word report columns, and real-time System Console logging when SHA-3 is computed. - Uses js-sha3's sha3_256 for standards-compliant FIPS-202 SHA-3. CryptoJS.SHA3 is legacy Keccak (SHA3("")=c5d2460..., vs FIPS-202 SHA3-256("")=a7ffc6f8...), so it is intentionally NOT used for this forensic-compliance column. Co-Authored-By: Claude Opus 4.8 --- index.html | 84 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 70 insertions(+), 14 deletions(-) diff --git a/index.html b/index.html index d276a17..cccea61 100644 --- a/index.html +++ b/index.html @@ -9,6 +9,8 @@ + + @@ -80,6 +82,8 @@ .table-header { background-color: #e9ecef; color: #333; font-weight: 700; border-bottom: 2px solid #ccc; } .hash-font { font-family: 'Courier New', monospace; font-size: 0.8rem; color: #004085; } .search-input { border-radius: 4px; padding: 8px 15px; border: 1px solid #ddd; background: white; } + .system-console { background: #0f172a; color: #d1fae5; font-family: 'Courier New', monospace; font-size: 0.8rem; max-height: 120px; overflow-y: auto; } + .system-console-entry { margin-bottom: 4px; } /* BLOG CARDS */ .news-section { background: #fff; padding: 60px 0; } @@ -290,6 +294,7 @@
Drag & Drop Evidence Files Here
Filename MD5 Hash SHA-256 (Section 63 BSA Compliant) + SHA3-256 (FIPS 202) @@ -297,6 +302,14 @@
Drag & Drop Evidence Files Here
+ +
+
System Console
+
+
Ready.
+
+
+ @@ -497,6 +510,7 @@
Yahoo/Outlook:
Calculating... Calculating... + Calculating... `); fileQueue.push({ file, rowId }); @@ -519,6 +533,8 @@
Yahoo/Outlook:
if (row) { row.querySelector('.md5').innerText = CryptoJS.MD5(wordArray).toString(); row.querySelector('.sha256').innerText = CryptoJS.SHA256(wordArray).toString(); + row.querySelector('.sha3').innerText = sha3_256(e.target.result); + addSystemLog(`SHA3-256 calculated for ${file.name}`); } processQueue(); }, 50); @@ -697,7 +713,7 @@
Yahoo/Outlook:
} // ===== GENERATE HASH PDF ===== - function generateHashPDF() { + async function generateHashPDF() { const { jsPDF } = window.jspdf; const doc = new jsPDF('l', 'pt', 'a4'); @@ -709,16 +725,20 @@
Yahoo/Outlook:
doc.text("FORENSIC HASH REPORT", 421, 32, { align: 'center' }); const rows = []; - document.querySelectorAll("#hashTableBody tr").forEach(tr => { + for (const tr of document.querySelectorAll("#hashTableBody tr")) { if (tr.querySelector('input').checked) { const cells = tr.querySelectorAll('td'); + const file = tr.fileData; + const sha256 = file ? await calculateSHA256(file) : cells[4].innerText; + const sha3 = file ? await calculateSHA3(file) : cells[5].innerText; rows.push([ cells[1].innerText, - cells[2].innerText, - cells[4].innerText + file ? file.name : cells[2].innerText, + sha256, + sha3 ]); } - }); + } if (rows.length === 0) { alert("Please select files to include in report."); @@ -727,7 +747,7 @@
Yahoo/Outlook:
doc.autoTable({ startY: 70, - head: [['#', 'Filename', 'SHA-256']], + head: [['#', 'Filename', 'SHA-256', 'SHA3-256 (FIPS 202)']], body: rows, theme: 'grid', headStyles: { @@ -740,9 +760,10 @@
Yahoo/Outlook:
font: 'courier' }, columnStyles: { - 0: { cellWidth: 40 }, - 1: { cellWidth: 300 }, - 2: { cellWidth: 450, font: 'courier' } + 0: { cellWidth: 35 }, + 1: { cellWidth: 260 }, + 2: { cellWidth: 260, font: 'courier' }, + 3: { cellWidth: 260, font: 'courier' } } }); @@ -750,7 +771,7 @@
Yahoo/Outlook:
} // ===== GENERATE HASH WORD ===== - function generateHashWord() { + async function generateHashWord() { if (typeof docx === 'undefined') { alert("Word library loading..."); return; @@ -782,24 +803,37 @@
Yahoo/Outlook:
alignment: AlignmentType.CENTER })], shading: { fill: "003366" } + }), + new TableCell({ + children: [new Paragraph({ + children: [new TextRun({ text: "SHA3-256 (FIPS 202)", bold: true, color: "FFFFFF" })], + alignment: AlignmentType.CENTER + })], + shading: { fill: "003366" } }) ] })); - document.querySelectorAll("#hashTableBody tr").forEach(tr => { + for (const tr of document.querySelectorAll("#hashTableBody tr")) { if (tr.querySelector('input').checked) { const cells = tr.querySelectorAll('td'); + const file = tr.fileData; + const sha256 = file ? await calculateSHA256(file) : cells[4].innerText; + const sha3 = file ? await calculateSHA3(file) : cells[5].innerText; rows.push(new TableRow({ children: [ new TableCell({ children: [new Paragraph(cells[1].innerText)] }), - new TableCell({ children: [new Paragraph(cells[2].innerText)] }), + new TableCell({ children: [new Paragraph(file ? file.name : cells[2].innerText)] }), new TableCell({ children: [new Paragraph({ - children: [new TextRun({ text: cells[4].innerText, font: "Courier New", size: 18 })] + children: [new TextRun({ text: sha256, font: "Courier New", size: 18 })] + })] }), + new TableCell({ children: [new Paragraph({ + children: [new TextRun({ text: sha3, font: "Courier New", size: 18 })] })] }) ] })); } - }); + } if (rows.length === 1) { alert("Please select files to include in report."); @@ -894,6 +928,28 @@
Yahoo/Outlook:
}); } + async function calculateSHA3(file) { + return new Promise(resolve => { + const reader = new FileReader(); + reader.onload = e => { + const sha3 = sha3_256(e.target.result); + addSystemLog(`SHA3-256 calculated for ${file.name}`); + resolve(sha3); + }; + reader.readAsArrayBuffer(file); + }); + } + + function addSystemLog(message) { + const consolePanel = document.getElementById('systemConsole'); + if (!consolePanel) return; + const entry = document.createElement('div'); + entry.className = 'system-console-entry'; + entry.innerText = `[${new Date().toLocaleTimeString()}] ${message}`; + consolePanel.appendChild(entry); + consolePanel.scrollTop = consolePanel.scrollHeight; + } + function toggleAll(checkbox) { document.querySelectorAll('input[name="fileSelect"]').forEach(c => c.checked = checkbox.checked); } From 30468698696ab28271954bac7c1c3ab927d3c47d Mon Sep 17 00:00:00 2001 From: Ethan Soh Date: Thu, 4 Jun 2026 11:34:09 +0800 Subject: [PATCH 2/2] Address Copilot hash report review --- index.html | 191 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 116 insertions(+), 75 deletions(-) diff --git a/index.html b/index.html index cccea61..c9598f7 100644 --- a/index.html +++ b/index.html @@ -5,15 +5,15 @@ Forensic & Compliance Portal - - + + - - - - - - + + + + + +