I'm attempting to iterate a string but seem to be getting a weird access violation, The problem is caused when passing a value returned from JSON.stringify because the data seems to be read only, upon many attempts to use hacky methods to solve the issue I have not been successful in doing so.
I've tried copying the data, manually iterating the string and copying the string over to another variable, but the issue still remains the same no matter what I've tried.
The code below works flawlessly when a protected piece of data is not passed
xor_swap(keys, data)
{
for(var i = 0; i < data.length; i++)
data[i] ^= this.xor_key_exchange(keys, i);
return data.toString('utf8');
}
How ever when applying a parameter (for instance JSON.stringify), The data becomes protected and no matter what I seem to do the data seems to not be modifiable.
var enc = this.xor_swap(keys,JSON.stringify(data));
Please note that the input is completely correct, I have tested this many times.
Of-course the expected output is that the string should be iteratable, and after speaking to a few people who are very experienced in nodejs they can't seem to see why this problem is being caused.
I am not using strict-mode for anyone asking.
Thanks to anyone who can help me with this problem