-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Match CRC from C code to crc-full #1
Comments
Hello, As in the readme: import {CRC} from 'crc-full'
var crc = new CRC(16, "CRC16", 0x1021, 0x0000, 0x0000, false, false);
var res = crc .compute([0x4F, 0x50, 0x4E, 0x17]); // Array with ascii integer of "OPN\x17" The result (number) is h_string = res.toString(16) Hope to been useful |
@RioloGiuseppe hello! Thank you very much for the quick response. I got it working! If I may, I'm whiling to contribute an update to your repo and package so it can be easily consumed from npm. Right now, you are asking people to install typescript, which shouldn't be required since they may want to use it on JS as well. If you accept the PR and will update the npm package, I can push it later Today. Thanks! |
You're welcome!
Yes, you are right, including the compiled javascript tsc will not a dependency any more. You can make a PR when you want. Best regards! |
Hello,
I have to send a message from typescript to our device and at the device side, it validates the message using a CRC16.
Here is how the device validates it:
The input data would be
"OPN\x17"
(where\x17
is anETB
control character). The output must beA8A9
.Given that input data, the C sample code, can you provide me a sample code using your package to achieve the same result?
Thank you! I appreciate any help.
Best regards,
Gutemberg
The text was updated successfully, but these errors were encountered: