In the BLAKE2 paper, the authors define
- Maximal depth (1 byte): an integer in [1, 255] (set to 255 if unlimited, and to 1 only in sequential mode)
- Node depth (1 byte): an integer in [0, 255] (set to 0 for the leaves, or in sequential mode)
Node depth is incremented as you approach the root node of the tree.
I was considering using BLAKE2b in tree mode with a fanout of 1 (e.g., a "unary" tree) for an iterated hashing scheme. The spec above says to set maximal depth to 255 for "unlimited" depth, but the node depth is only one byte so can only uniquely denote nodes in trees smaller than this depth.
First, is there a reasonable way to achieve arbitrarily-deep trees (e.g., on the order of 2^48 nodes deep) with BLAKE2b? And second, is this way preferable to some other approach?
Edit: One idea that comes to mind is to swap the interpretation of the
node offset and
node depth fields for the purpose of this scheme, since
node offset would otherwise go unused (all trees in this scheme have an offset of
0), and it's a 64-bit value.