I wouldn’t even bother messing with any strings. Just keep everything in byte form. The value
coming into the function should already be numeric. So you shouldn’t even have to convert that. Make sense?
And I don’t think you should be using those square brackets as I said earlier. Try this:
var cs = 0x07 ^ 0x00 ^ 0x01 ^ 0x15 ^ 0x01 ^ value;