Giter Club home page Giter Club logo

Comments (3)

SeaHOH avatar SeaHOH commented on May 31, 2024 1

Looks like the seed is a array (list in Python) object, and its members' type is Number (int in Python). So, the code may like this:

byte_array = list(bytes.fromhex("93 14 2C 08"))  # both bytes and bytearray are OK
array = ctx1.call("calculateKey", byte_array)

from jsengine.

SeaHOH avatar SeaHOH commented on May 31, 2024

Why bytearrays? JavaScript has no this type, how does it work in JavaScript?

Here use string (ctx.eval) and supported types by json (ctx.call) to pass arguments to the backend engines.

from jsengine.

pompushko avatar pompushko commented on May 31, 2024

Why bytearrays? JavaScript has no this type, how does it work in JavaScript?

Here use string (ctx.eval) and supported types by json (ctx.call) to pass arguments to the backend engines.

Thank you for responce. Actually, I am not good in JS :)

Here is a part code of JS script:

function calculateKey(seed) {
    if (seed.length < 4) {
        throw "seed length must be at least 4";
    }

    var hiSeed = ((seed[0] << 8) + seed[1]) & 0xFFFFFFFF;
    var loSeed = ((seed[2] << 8) + seed[3]) & 0xFFFFFFFF;

and I still cant understand how to pass my byte arrar to that function :(

from jsengine.

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.