blake3 icon indicating copy to clipboard operation
blake3 copied to clipboard

memory optimization or bug? the 4 PB limit of Hasher.stack

Open glycerine opened this issue 9 months ago • 1 comments

type Hasher struct {
    // log(n) set of Merkle subtree roots, at most one per height.                  
    stack   [64 - (guts.MaxSIMD + 10)][8]uint32 

I think technically that should be log2(guts.MaxSIMD)==4, instead of guts.MaxSIMD == 16, to get full 2^64-1 input support that the spec requires.

Its an extra 12*32 = 384 bytes per Hasher (so from 1216 bytes -> 1536 bytes for the stack), so probably not too expensive.

glycerine avatar Feb 01 '25 16:02 glycerine

I think you're right -- good catch!

lukechampine avatar Feb 03 '25 15:02 lukechampine