diff --git a/index.html b/index.html index d276a17..919abd6 100644 --- a/index.html +++ b/index.html @@ -287,9 +287,10 @@
Drag & Drop Evidence Files Here
# - Filename - MD5 Hash - SHA-256 (Section 63 BSA Compliant) + Filename + MD5 Hash + SHA-256 (Section 63 BSA Compliant) + SHA-3-256 Hash @@ -497,6 +498,7 @@
Yahoo/Outlook:
Calculating... Calculating... + Calculating... `); fileQueue.push({ file, rowId }); @@ -519,6 +521,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 = CryptoJS.SHA3(wordArray, { outputLength: 256 }).toString(); + console.log(`SHA-3-256 calculated for ${file.name}`); } processQueue(); }, 50); @@ -612,7 +616,8 @@
Yahoo/Outlook:
const text = await readFile(files[i]); const emailData = parseEml(text); - const sha256 = await calculateSHA256(files[i]); + const sha256 = await calculateHash(files[i], 'SHA256'); + const sha3 = await calculateHash(files[i], 'SHA3-256'); // HEADER WITH WRAPPED FILENAME doc.setFillColor(0, 51, 102); @@ -646,7 +651,8 @@
Yahoo/Outlook:
['Message-ID', emailData.messageId], ['Originating IP', emailData.serverIP], ['DKIM Status', emailData.dkim], - ['SHA-256 Hash', sha256] + ['SHA-256 Hash', sha256], + ['SHA-3-256 Hash', sha3] ], theme: 'grid', headStyles: { @@ -715,7 +721,8 @@
Yahoo/Outlook:
rows.push([ cells[1].innerText, cells[2].innerText, - cells[4].innerText + cells[4].innerText, + cells[5].innerText ]); } }); @@ -727,7 +734,7 @@
Yahoo/Outlook:
doc.autoTable({ startY: 70, - head: [['#', 'Filename', 'SHA-256']], + head: [['#', 'Filename', 'SHA-256', 'SHA-3-256']], body: rows, theme: 'grid', headStyles: { @@ -741,8 +748,9 @@
Yahoo/Outlook:
}, columnStyles: { 0: { cellWidth: 40 }, - 1: { cellWidth: 300 }, - 2: { cellWidth: 450, font: 'courier' } + 1: { cellWidth: 240 }, + 2: { cellWidth: 270, font: 'courier' }, + 3: { cellWidth: 270, font: 'courier' } } }); @@ -782,6 +790,13 @@
Yahoo/Outlook:
alignment: AlignmentType.CENTER })], shading: { fill: "003366" } + }), + new TableCell({ + children: [new Paragraph({ + children: [new TextRun({ text: "SHA-3-256", bold: true, color: "FFFFFF" })], + alignment: AlignmentType.CENTER + })], + shading: { fill: "003366" } }) ] })); @@ -795,6 +810,9 @@
Yahoo/Outlook:
new TableCell({ children: [new Paragraph(cells[2].innerText)] }), new TableCell({ children: [new Paragraph({ children: [new TextRun({ text: cells[4].innerText, font: "Courier New", size: 18 })] + })] }), + new TableCell({ children: [new Paragraph({ + children: [new TextRun({ text: cells[5].innerText, font: "Courier New", size: 18 })] })] }) ] })); @@ -837,7 +855,7 @@
Yahoo/Outlook:
// ===== DOWNLOAD CSV ===== function downloadSelectedCSV() { - let csv = "#,Subject,From,To,Date,Originating IP,DKIM,SHA-256\n"; + let csv = "#,Subject,From,To,Date,Originating IP,DKIM,SHA-256,SHA-3-256\n"; let counter = 1; const promises = []; @@ -848,7 +866,7 @@
Yahoo/Outlook:
promises.push( readFile(tr.fileData).then(text => { const eml = parseEml(text); - return `${counter++},"${eml.subject}","${eml.from}","${eml.to}","${eml.date}","${eml.serverIP}","${eml.dkim}","${cells[4].innerText}"\n`; + return `${counter++},"${eml.subject}","${eml.from}","${eml.to}","${eml.date}","${eml.serverIP}","${eml.dkim}","${cells[4].innerText}","${cells[5].innerText}"\n`; }) ); } @@ -883,11 +901,15 @@
Yahoo/Outlook:
}); } - async function calculateSHA256(file) { + async function calculateHash(file, algorithm = 'SHA256') { return new Promise(resolve => { const reader = new FileReader(); reader.onload = e => { const wordArray = CryptoJS.lib.WordArray.create(e.target.result); + if (algorithm === 'SHA3-256') { + resolve(CryptoJS.SHA3(wordArray, { outputLength: 256 }).toString()); + return; + } resolve(CryptoJS.SHA256(wordArray).toString()); }; reader.readAsArrayBuffer(file); @@ -924,7 +946,7 @@
Yahoo/Outlook:
const response = document.getElementById('botResponse'); let text = ""; if (type === 'BSA') text = "Section 63(4) of BSA 2023 (formerly 65B IEA) requires electronic evidence to be accompanied by a certificate for court admissibility."; - if (type === 'HASH') text = "SHA-256 cryptographic hash ensures file integrity and proves the evidence hasn't been tampered with since collection."; + if (type === 'HASH') text = "SHA-256 and SHA-3-256 cryptographic hashes ensure file integrity and prove the evidence hasn't been tampered with since collection."; if (type === 'EML') text = "Gmail: Open email → Three Dots (⋮) → Download message. Always use .EML format for legal integrity."; response.innerHTML = `${text}`; }