xor.fallback.js 361 B

12345678910111213
  1. module.exports = {
  2. xor: function (payload, maskBytes, maskPos) {
  3. var end = payload.length;
  4. if (typeof(maskPos) !== 'number') {
  5. maskPos = 0;
  6. }
  7. for (var i=0; i < end; i++) {
  8. payload[i] = payload[i] ^ maskBytes[maskPos];
  9. maskPos = (maskPos + 1) & 3;
  10. }
  11. return maskPos;
  12. }
  13. };