Hash algorithm for dynamic growing/streaming data?

后端 未结 3 561
南笙
南笙 2020-12-10 16:38

Are there any algorithms that you can continue hashing from a known hash digest? For example, the client upload a chunk of file to ServerA, I can get a

3条回答
  •  無奈伤痛
    2020-12-10 17:11

    This is theoretically possible (the md5 so far should contain all the state you need to continue) but it looks like the normal APIs don't provide what you need. If you can suffice with a CRC instead, this will probably be a lot easier, since those are more commonly used for the "streaming" cases like you need. See here:

    binascii.crc32(data[, crc])

    crc32() accepts an optional crc input which is the checksum to continue from.

    Hope that helps.

提交回复
热议问题