Comments (3)
We've also noticed this issue on a 16-bit platform so I was pleased to see this bug! It was low priority for us, but I finally got around to checking if there was an updated version here...
Digging a little into the code, it specifically says that you need to change the definition of "WORD" for 16-bit machines.
https://github.com/B-Con/crypto-algorithms/blob/master/sha256.h#L20
Did you make that adjustment?
I've changed the code in md5.h, sha1.h and sha256.h (so they all match) on our system to:
#include <stdint.h>
typedef uint32_t WORD;
I can't test it until tomorrow, but I expect that's the issue - I'll report back tomorrow.
from crypto-algorithms.
A long time after the fact making this comment, but I also needed an additional change in sha1.c and sha256.c as my compiler (NC308 Renesas) was not promoting the BYTEs to WORDs when performing the build of the WORDs from BYTES.
for (i = 0, j = 0; i < 16; ++i, j += 4) m[i] = ((WORD)data[j] << 24) | ((WORD)data[j + 1] << 16) | ((WORD)data[j + 2] << 8) | ((WORD)data[j + 3]);
WIthout this, the assembly code shows that the left shift operations were overflowing so was only the low byte (3).
from crypto-algorithms.
Do you slove this issue
from crypto-algorithms.
Related Issues (17)
- Implementation error in the ARCFOUR cipher
- about license HOT 2
- Typedefs on Windows HOT 1
- Licence missing HOT 5
- des.c compile error
- Incorrect reference hash for "aaaaaaaaaa" HOT 2
- Support AES256/CBC/PKCS7Padding ?
- file md5 error
- sha256.c Warning C4244'=': conversion from 'unsigned __int64' to 'BYTE', possible loss of data
- The value of SHA256_BLOCK_SIZE seems not correct HOT 4
- One of the comments in blowfish.c may be wrong
- Signed overflow undefined behavior in md5.c
- Context doesn't get cleaned up after being used
- There is no 32-bit WORD. That's called a DWORD HOT 2
- Base64_test fails HOT 3
- Aes.h missing aes_decrypt_cbc?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crypto-algorithms.