force-net / Crc32.NET

Fast version of Crc32 algorithm for .NET
MIT License
199 stars 52 forks source link

Added Stream functionality #13

Closed angedelamort closed 5 years ago

angedelamort commented 5 years ago
angedelamort commented 5 years ago

It's my first pull request on github, so I'm not sure if everything is correct... but seems simple enough.

I've asked for the feature (in issue) but decided to make the change instead since I wanted to have it.

force-net commented 5 years ago

Ok. Thank you, when I find the time to update code, I'll review and merge your PR.

angedelamort commented 5 years ago

Just found out a use case where my modification doesn't work well with a Stream. I did my test thinking about a MemoryStream where it's easy to create a "sub" buffer using parametrized constructor, but in most cases, the Stream sub class won't have this feature. Also, in most case, it should be ok as it is, but again, since doing the change, it should support the same feature as the buffer (providing the offset and length -> Compute(Stream, long, long)). For example, if you want to calculate de CRC32 of the 1024 first bytes of a file. I'll try to address that in a future pull request. Thanks