alexgorbatchev / crc

Blazingly fast CRC implementations for node.js and browser
MIT License
349 stars 72 forks source link

Added crc16_xmodem bitwise calculation #34

Closed albertjleo closed 9 years ago

albertjleo commented 9 years ago

Hi Alex,

I came across your useful library, but I needed the xmodem implementation which was missing, although it was present in the pycrc library.

Therefore I have added crc16_xmodem bitwise implementation, since I am not familiar with python or the pycrc lib, I wasn't quite sure how to generate the optimised table implementation.

It would be great if this could be merged, since we use both ccitt and xmodem.

Proposed Mods: It would also be good to add the ability to pass along with the buffer the startIndex and endIndex to use rather than assume the entire buffer needs to be used when computing the CRC.

Also it would be good to have a Factory that can provide the ability to choose from the different models, this might already be present in the existing code, in which case could you please explain how to use it.

Regards Albert

albertjleo commented 9 years ago

I've corrected it, should've picked this up earlier, however the tests were failing due to \r in the expected checksum result, the actual checksum values match (perhaps due to running them on a Windows PC?)

alexgorbatchev commented 9 years ago

Very nice, thanks for the PR. Merged and published as v3.3.0