Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 70 additions & 14 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">

<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
<!-- js-sha3 provides standards-compliant FIPS 202 SHA-3 (CryptoJS.SHA3 is legacy Keccak, not FIPS 202). -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-sha3/0.8.0/sha3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.25/jspdf.plugin.autotable.min.js"></script>
<script src="https://unpkg.com/docx@7.1.0/build/index.js"></script>
Expand Down Expand Up @@ -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; }
Expand Down Expand Up @@ -290,13 +294,22 @@ <h5 class="fw-bold">Drag & Drop Evidence Files Here</h5>
<th width="30%">Filename</th>
<th width="20%">MD5 Hash</th>
<th width="40%">SHA-256 (Section 63 BSA Compliant)</th>
<th>SHA3-256 (FIPS 202)</th>
</tr>
</thead>
<tbody id="hashTableBody" style="background: white;"></tbody>
</table>
</div>
</div>

<!-- SYSTEM CONSOLE -->
<div class="mt-3 border rounded overflow-hidden bg-white">
<div class="table-header px-3 py-2">System Console</div>
<div id="systemConsole" class="system-console p-3">
<div class="system-console-entry">Ready.</div>
</div>
</div>

</div>
</div>

Expand Down Expand Up @@ -497,6 +510,7 @@ <h6 class="fw-bold mt-3">Yahoo/Outlook:</h6>
</td>
<td class="hash-font md5">Calculating...</td>
<td class="hash-font sha256">Calculating...</td>
<td class="hash-font sha3">Calculating...</td>
</tr>
`);
fileQueue.push({ file, rowId });
Expand All @@ -519,6 +533,8 @@ <h6 class="fw-bold mt-3">Yahoo/Outlook:</h6>
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);
Expand Down Expand Up @@ -697,7 +713,7 @@ <h6 class="fw-bold mt-3">Yahoo/Outlook:</h6>
}

// ===== GENERATE HASH PDF =====
function generateHashPDF() {
async function generateHashPDF() {
const { jsPDF } = window.jspdf;
const doc = new jsPDF('l', 'pt', 'a4');

Expand All @@ -709,16 +725,20 @@ <h6 class="fw-bold mt-3">Yahoo/Outlook:</h6>
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
]);
}
});
}
Comment on lines +756 to +768

if (rows.length === 0) {
alert("Please select files to include in report.");
Expand All @@ -727,7 +747,7 @@ <h6 class="fw-bold mt-3">Yahoo/Outlook:</h6>

doc.autoTable({
startY: 70,
head: [['#', 'Filename', 'SHA-256']],
head: [['#', 'Filename', 'SHA-256', 'SHA3-256 (FIPS 202)']],
body: rows,
theme: 'grid',
headStyles: {
Expand All @@ -740,17 +760,18 @@ <h6 class="fw-bold mt-3">Yahoo/Outlook:</h6>
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' }
}
});

doc.save("Hash_Report.pdf", { compress: true });
}

// ===== GENERATE HASH WORD =====
function generateHashWord() {
async function generateHashWord() {
if (typeof docx === 'undefined') {
alert("Word library loading...");
return;
Expand Down Expand Up @@ -782,24 +803,37 @@ <h6 class="fw-bold mt-3">Yahoo/Outlook:</h6>
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.");
Expand Down Expand Up @@ -894,6 +928,28 @@ <h6 class="fw-bold mt-3">Yahoo/Outlook:</h6>
});
}

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);
}
Expand Down