feat: add SHA-3 (Keccak-256) hashing support - #32
Open
vkehs58-oss wants to merge 1 commit into
Open
Conversation
Adds a SHA-3 (Keccak-256) column to the Bulk Evidence Hash Reporter, computed client-side via the already-loaded CryptoJS bundle. The new digest is included in the Hash PDF, Hash Word, Email CSV, and Email Forensic PDF exports, and each calculation is logged in real time to the browser console. Closes amithmandassociates-oss#2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add SHA-3 (Keccak-256) Hashing Support
Closes #2
What this does
FileReader→WordArraypipeline as the existing MD5/SHA-256 columns. No new dependencies: the CryptoJS 4.1.1 bundle already shipped with the page includesCryptoJS.SHA3.generateHashPDF, new column with courier styling to match SHA-256)generateHashWord, new header + body cells)downloadSelectedCSV, new trailing column)generateEmailReport, new "SHA-3 (Keccak-256) Hash" row via a newcalculateSHA3()helper mirroringcalculateSHA256())[System Console] SHA-3 (Keccak-256) calculated for "<file>": <digest>as requested.A note on Keccak vs FIPS 202 (why the column says "Keccak-256")
CryptoJS.SHA3implements original Keccak padding, not the final FIPS 202 padding. I verified this against known test vectors before wiring it in:CryptoJS.SHA3(…, {outputLength: 256})c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470a7ffc6…)"abc"4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45Since the issue explicitly requests
CryptoJS.SHA3integration and is titled "SHA-3 (Keccak)", I used it as requested but labeled the column "SHA-3 (Keccak-256)" so reports are honest about the exact algorithm — important for forensic/evidentiary use. If you'd rather have strict FIPS 202 SHA3-256 output, I'm happy to swap in a FIPS-compliant implementation (e.g. js-sha3) in a follow-up commit — just say the word.I picked the 256-bit output length to match the security level and visual width of the existing SHA-256 column (CryptoJS defaults to 512-bit otherwise, which overflows the table and PDF layouts).
Verification
Tested in headless Chromium by dropping a file with known content (
"abc") into the live page:900150983cd24fb0d6963f7d28e17f72✔ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad✔4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45✔ (matches published Keccak-256 test vector)[System Console]log line ✔Single-file diff (+47/−15), follows the existing code style throughout.
/claim #2