Giter Site home page Giter Site logo

Comments (3)

RioloGiuseppe avatar RioloGiuseppe commented on May 25, 2024 1

You're welcome!
Yes. To do it fast I used this online tool, so OPN became 0x4F, 0x50, 0x4E and \x17 is an escaped form of 0x17 (I don 't know in which convention).

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.

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!

from crc-full.

RioloGiuseppe avatar RioloGiuseppe commented on May 25, 2024

Hello,
I just made some tries. I think you get a wrong result because you are passing "OPN\x17" as string. If you pass the equivalent byte array of ascii characters, you will havethe same result of C/C++.

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 43177 but if you convert to an hex string you will have: 'a8a9', that is the same result obtained in C.

h_string = res.toString(16)

Hope to been useful
Best regards
Giuseppe Riolo

from crc-full.

galvesribeiro avatar galvesribeiro commented on May 25, 2024

@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!

from crc-full.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.