com.neovisionaries.ws.client.DefaultMasker Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cdp4j Show documentation
Show all versions of cdp4j Show documentation
cdp4j - Chrome DevTools Protocol for Java
package com.neovisionaries.ws.client;
public class DefaultMasker implements Masker {
byte[] maskingKey;
public DefaultMasker() {
this.maskingKey = Misc.nextBytes(4);
}
public byte[] getMaskingKey() {
return this.maskingKey;
}
public void mask(byte[] payload) {
if (payload == null)
{
return;
}
for (int i = 0; i < payload.length; ++i)
{
// Mask
payload[i] = (byte) ((payload[i] ^ this.maskingKey[i % 4]) & 0xFF);
}
}
}