Javascript CRC16 sample code or implementation

女生的网名这么多〃 提交于 2019-12-24 06:18:08

问题


can anybody share a link or sample code to implement checksum for string in javascript? Thanks a lot in advance


回答1:


What do you want?

You need to be more specific.

There is a huge plethora of CRC16 algorithms, each one with its own polynomial and for a specific use. Some CRC16 algorithms are really good to create hashes ( for Redis, for example ) while others are better for wire communication.

  • https://en.wikipedia.org/wiki/Cyclic_redundancy_check#Polynomial_representations_of_cyclic_redundancy_checks

I just want anything, I really don't care what

If this is the road you want to go with, then GitHub and NPM have many implementations that could work for you.

Their documentation is usually downright horrible or non-existent and there is no guarantee they will work as advertised, but if anything goes, you can always give them a try, and if you find a bug you can always report it in their issues page.

Here is a quick implementation I found, should be what you need:

  • https://github.com/donvercety/node-crc16/blob/master/crc16.js


来源:https://stackoverflow.com/questions/45795958/javascript-crc16-sample-code-or-implementation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!