Bao uses a similar algorithm for hashing input incrementally. There's a stack of partially completed subtrees, which get merged together as more input arrives. There's also a cute trick, where you can use the number of binary 1's in the count of leaves so far, to tell you when to merge subtrees. Here's the Python version: https://github.com/oconnor663/bao/blob/0.5.0/tests/bao.py#L176-L205
_______________________________________________ Messaging mailing list Messaging@moderncrypto.org https://moderncrypto.org/mailman/listinfo/messaging