Is there a way to generate an incremental checksum?
Hi
Is there a way to generate an MD5 checksum of a file by performing a checksum against the file's parts? We potentially have to process large files and therefore cannot keep the entire file in memory. From what I understand checksum related logic is typically stateful, allowing file data to be passed through sequentially, however it appears cache script offers only stateless functions offering a simple method of generating a single checksum hash from a single string (or stream), correct me if I'm wrong?
Product version: HealthShare 2017.2
There is a $System.Encryption.MD5HashStream() that does not read whole stream into the memory
Perfect! The source code for that class method is exactly what I need, thank you.
Just for others who have the same problem, you can do the following:
do $System.Encryption.MD5HashInit() do $System.Encryption.MD5HashUpdate(stream.Read(...)) // Read in each chunk stream set hash = $System.Encryption.MD5HashFinal() set checksum = $ZCONVERT(##class(%xsd.hexBinary).LogicalToXSD(hash), "L")