dustman31 / sha-3 Goto Github PK
View Code? Open in Web Editor NEWC++ implementation of SHA-3 hash.
C++ implementation of SHA-3 hash.
Its complete junk.
1)state->length isnt a uint64_t count.
2)A is a 25 uint64
3)'for' really terrible
'Keccak.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\kernel32.dll'
The thread 0x1184 has exited with code 0 (0x0).
The program '[8172] Keccak.exe' has exited with code 0 (0x0).
What version you use VS ?
Or how I can solve this problem ?
Do you have a favourite unit testing framework? I can hopefully get the time to write a couple of simple tests. I note you are developing in visual studio- therefore maybe one of https://docs.microsoft.com/en-us/visualstudio/test/writing-unit-tests-for-c-cpp?view=vs-2019
The code looks like it computes the digest properly, but sha3Digest truncates the output to 24 bytes (192 bits), because math is 64-bit. The last 4 bytes are missing from the result.
fairly self explanatory. I have used the boost/beast implementation, which has a very open (but bespoke) licence here
Bjorn Nilsson pointed out the following:
In the doFile function, the keccakUpdate call looks different for the three hash types:
For hashType 0: keccakUpdate((uint8_t*)buf, 0, bytesRead, st);
For hashType 1: keccakUpdate((uint8_t*)buf, 0, bufferSize, st);
For hashType 2: keccakUpdate((uint8_t*)buf, 0, bufferSize, st);Is the difference bytesRead vs bufferSize intentional? It seems to me the code might feed uninitialized buffer for hashType 1 and 2 if bytesRead<bufferSize.
This is correct - it should have been bytesRead. This was likely missed when I converted the project from reading the whole file at once. I have pushed the fix, and encourage users to update to this version.
My Code:
Input ”A“
Debug(Correct):
421a35a60054e5f383b6137e43d44e998f496748cc77258240ccfaa8730b51f40cf47c1bc09c728a8cd4f096731298d51463f15af89543fed478053346260c38
Release:
fff33bdfffbfdbffb5712b45afaa596feaf59e440bf66b0f18948e4cc9ebc144e7c9f0a0aa3c8fc7375e2a4fc8add620f28210b2cb87f1d040448b62fbe7392a
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.