Giter Site home page Giter Site logo

Comments (3)

karora avatar karora commented on July 17, 2024

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.

youca04 avatar youca04 commented on July 17, 2024

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.

Weird733 avatar Weird733 commented on July 17, 2024

Do you slove this issue

from crypto-algorithms.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.