diff --git a/lib/faye/websocket/protocol8_parser.js b/lib/faye/websocket/protocol8_parser.js index 4ad6646..7bb94ff 100644 --- a/lib/faye/websocket/protocol8_parser.js +++ b/lib/faye/websocket/protocol8_parser.js @@ -5,7 +5,7 @@ var Handshake = function(uri, stream) { this._stream = stream; var buffer = new Buffer(16), i = 16; - while (i--) buffer[i] = Math.floor(Math.random() * 254); + while (i--) buffer[i] = Math.floor(Math.random() * 256); this._key = buffer.toString('base64'); var SHA1 = crypto.createHash('sha1'); @@ -256,7 +256,7 @@ var instance = { frame[0] = this.FIN | opcode; if (this._masking) { - mask = [1,2,3,4].map(function() { return Math.floor(Math.random() * 255) }); + mask = [1,2,3,4].map(function() { return Math.floor(Math.random() * 256) }); for (i = 0, n = data.length; i < n; i++) data[i] = data[i] ^ mask[i % 4]; }