Crypto engines cpp - #2
Merged
Merged
Conversation
Repository restructured from coursework layout to a coherent two-layer toolkit:
C++ layer (cpp/):
- sha256/: SHA-256 from FIPS PUB 180-4, no external dependencies
- pow/: parallel prefix brute-forcer using std::thread + std::atomic across all cores
- collision/: birthday attack on djb2 32-bit hash, single and parallel modes
- bitcoin/: raw P2PKH tx builder — Base58Check, varint, SIGHASH_ALL preimage, DER layout
TypeScript/Solidity layer:
- contracts/ and test/ flattened from implementation/exercise-{1,2}/
- Python Tkinter clients removed; replaced with ethers.js CLI scripts (scripts/)
- Unified hardhat.config.ts and package.json at repo root
- deploy-vending.ts, deploy-ticket.ts, vending.ts, tickets.ts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Delete remaining tracked files under implementation/ (old exercise READMEs referencing Python/Tkinter, and typechain artifacts from ex-1). These were left over from the restructure and contradicted the project's current stack. - Rename ganache container from ganache-ex1 to ganache. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Two parallel jobs: - cpp: cmake Release build, then smoke-tests pow (single prefix), collision, and tx_builder to verify all three engines run end-to-end - solidity: npm ci, hardhat build, hardhat test against the in-memory EDR network (no Ganache required in CI) Also accepts optional prefix args in pow so CI can run a short target without waiting for the full 32s 'decade' search.
hardhat run does not forward process.argv to scripts, so the previous vending.ts / tickets.ts CLIs silently ignored every command argument. Hardhat tasks receive typed, named options and are the idiomatic way to expose contract interactions as CLI commands: npx hardhat vending list --network ganache npx hardhat vending buy --product-id 1 --qty 2 --network ganache npx hardhat ticket list --network ganache npx hardhat ticket buy --event-id 1 --network ganache npx hardhat ticket list-resale --ticket-id 1 --price 0.03 --network ganache Deploy scripts (deploy-vending.ts, deploy-ticket.ts) are unchanged — they do not need arguments so hardhat run is fine for those.
Six test vectors (empty, "abc", 448-bit, "bitcoin", 55-byte, 56-byte) verify the implementation against authoritative Python hashlib values. CMakeLists.txt wires the test into ctest; CI runs ctest --output-on-failure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix 'evemts'/'evetns'/'intrecations' typos in Solidity comments. Add tsconfig.json targeting ES2022/Node16 for the TS task files. Exclude the leftover untracked implementation/ directory via .gitignore. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- README layout table: scripts/vending.ts + tickets.ts → tasks/vending.ts + ticket.ts; test files corrected to .ts extension - README CLI examples: npm run vending/tickets → npx hardhat vending/ticket with correct --option-name flags matching the Hardhat 3 task definitions - VendingMachine.sol: bump pragma from ^0.8.20 to ^0.8.24 to match TicketOffice.sol and the hardhat.config.ts compiler version - package.json: add engines field declaring Node >=20 requirement Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Hardhat 3 dropped support for Node 20; bump CI setup-node and the engines field to >=22. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Rename getEvent() → getEventById() in TicketOffice.sol: ethers.js BaseContract exposes its own getEvent(nameOrTopic) method which shadowed the Solidity function, causing 'key.format is not a function'. Replace hre.network.connect() with hre.network.getOrCreate() across all task and test files to clear the Hardhat 3 deprecation warning. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main edited the old exercise-1 README; our branch already removed the entire implementation/ directory as part of the homework → portfolio cleanup. Keeping the deletion. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
No description provided.