D-Nice / hmacsha1

Pure-solidity implementation of the SHA1 hash function + HMAC
BSD 2-Clause "Simplified" License
3 stars 3 forks source link

error in copyBytes function #1

Open samanshahmohamadi opened 5 years ago

samanshahmohamadi commented 5 years ago

Hi There is a syntax error in copyBytes function (lines 91-93). This piece of code is not compiled:

assembly {
        add(minLength, toOffset)
        to
        mstore
      }
D-Nice commented 5 years ago

Hi

The piece of code is compiled, however, the assembly does make presumptions on the memory layout, and is targetted at solc 0.4.15. I tested this as working up till 0.4.21. Beyond 0.4.22 there were memory layout changes, so assembly code that plays with memory, likely broke. I would have to investigate which code is the culprit in fact, whether it's the hmac or sha1 code, and then look to appropriately update it to work with up to 0.4.25.

Is this something you need for a project or were just randomly trying. I'm looking to gauge and get an idea of the importance of this so I can decide how much time to invest into this.