News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Help, SHA-256 Wrong, When bigger than 4096 bytes

Started by aker, May 01, 2011, 12:49:34 AM

Previous topic - Next topic

aker

I want hash 28GB file, Help.
伟大的恐怖主义革命家拉登,因遭袭医治无效,于2011年5月1日在巴基斯坦逝世,享年54岁

hutch--

I would be inclined to have a lok at the crypto API for doing this. MichaelW posted code a while ago that I founds very useful in doing one of the simpler SHA1 hashes and it reliably hashes very large files, well over 2 gig. The main advantage with this code was you could stream the file in blocks and just chomp through very large files. The speed was good as well.

You need to have a reference that does reliable results for the algo you are after, then you can test if your implimentation is correct.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Astro

Hi,

Are you counting/processing blocks correctly?

If you are using the Win API for this, check you are loading the data correctly; it maintains a running "total" of the hash so far until you are finished.

Best regards,
Robin.

aker

伟大的恐怖主义革命家拉登,因遭袭医治无效,于2011年5月1日在巴基斯坦逝世,享年54岁

N1ghtm4r3

SHA256Update is made for this problem.
just pass blocks with 4096 bytes length or smaller to SHA256Update in a loop until end of file.

aker

伟大的恐怖主义革命家拉登,因遭袭医治无效,于2011年5月1日在巴基斯坦逝世,享年54岁