Closed attilah closed 1 year ago
Latest Jint 3 beta seems to work correctly:
jint> 1359893119 << 26
-67108864
So the library should be updated or some custom JS function to be used (can also be CLR function if this SSJS thing allows registering those).
@lahma unfortunately CLR is not enabled (for obvious security reasons) in SFMC :-( I doubt that Salesforce will update the JS runtime engine if they haven't done it in years :-( stuck at ES3...I think it says it all.
Trying to get a workaround with custom JS but it is far from ideal.
I don't know if Salesforce has any issue tracker to file an issue about updating. They would benefit in many ways, like new syntax support, manyfold performance increase in some scenarios.
As there's not much that we can do on Jint side, I'll convert this to discussion.
Tried to implement hmac sha-256 for marketing cloud in SSJS which is powered by some old version of Jint and it turns out that most of the bitwise operations are either returning wrong result or throwing ArithmeticOverflowException.
Simplest issue I ran into is this:
Correct value would be:
-67108864
Do you recall any issue around this Sebastien?
This shows the issue in more detail: https://salesforce.stackexchange.com/questions/363226/ssjs-left-shift-operator-and-2s-complement-different-behaviour-than-in-j