js-md5 icon indicating copy to clipboard operation
js-md5 copied to clipboard

Wrong result with file size between 2G and 4G

Open wugifer opened this issue 7 years ago • 1 comments

Hello,

When I calc a file of 2,369,284,818 bytes, I got a different result from other md5 tools.

I changed line 338 of md5.js from

blocks[15] = this.hBytes << 3 | this.bytes >> 29;

to

blocks[15] = this.hBytes << 3 | (this.bytes >> 29 & 7);

then all is OK. And more, when I calc "2369284818 >> 29" in my chrome browser, I got "-4", not "4"

wugifer avatar Dec 18 '17 05:12 wugifer

thanks for report. mistake to use >>, should be >>>. v0.7.3 fixed this.

emn178 avatar Dec 18 '17 11:12 emn178