Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I needed a way to feed a Digest a stream of bytes while checking the CRC for possible matches after each byte. Using CRC::crc directly would make this O(n^2), so I looked to Digest. Because Digest::finalize consumes self, it must be thrown out after each finalize operation. This is probably what you want in the general case, but not in my slightly weird case. This problem can be solved by allowing Digest to be duplicated, thereby letting the user "fork" the CRC state as desired. (This also enables certain niche CRC-search algorithms.) I went with Clone rather than Copy because making Digest Copy seemed potentially error-prone; Clone has the advantage of requiring explicit intent.
- Loading branch information