本文整理了Java中net.consensys.cava.bytes.Bytes.xor()
方法的一些代码示例,展示了Bytes.xor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.xor()
方法的具体详情如下:
包路径:net.consensys.cava.bytes.Bytes
类名称:Bytes
方法名:xor
[英]Return a bit-wise XOR of these bytes and the supplied bytes.
If this value and the supplied value are different lengths, then the shorter will be zero-padded to the left.
[中]返回这些字节和提供的字节的按位异或。
如果此值和提供的值长度不同,则较短的值将在左侧填充为零。
代码示例来源:origin: net.consensys.cava/cava-bytes
@Override
public <T extends MutableBytes> T xor(Bytes other, T result) {
return delegate.xor(other, result);
}
代码示例来源:origin: net.consensys.cava/cava-bytes
@Override
public Bytes xor(Bytes other) {
return delegate.xor(other);
}
代码示例来源:origin: net.consensys.cava/cava-bytes
/**
* Return a bit-wise XOR of these bytes and the supplied bytes.
*
* <p>
* If this value and the supplied value are different lengths, then the shorter will be zero-padded to the left.
*
* @param other The bytes to perform the operation with.
* @return The result of a bit-wise XOR.
*/
default Bytes xor(Bytes other) {
return xor(other, MutableBytes.create(Math.max(size(), other.size())));
}
代码示例来源:origin: net.consensys.cava/cava-rlpx
private Bytes calculateMac(Bytes input, boolean ingress) {
Bytes mac = Bytes.wrap(new byte[16]);
macEncryptionEngine.processBlock(
snapshot(ingress ? ingressMac : egressMac).slice(0, 16).toArrayUnsafe(),
0,
mac.toArrayUnsafe(),
0);
mac = mac.xor(input);
if (ingress) {
mac = updateIngress(mac).slice(0, 16);
} else {
mac = updateEgress(mac).slice(0, 16);
}
return mac.slice(0, 16);
}
代码示例来源:origin: net.consensys.cava/cava-rlpx
Bytes frameMacSeed = updateIngress(messageFrame.slice(32, frameSize + pad));
macEncryptionEngine.processBlock(frameMacSeed.toArrayUnsafe(), 0, newFrameMac.toArrayUnsafe(), 0);
Bytes expectedFrameMac = updateIngress(newFrameMac.xor(frameMacSeed.slice(0, 16))).slice(0, 16);
if (!expectedFrameMac.equals(frameMac)) {
throw new InvalidMACException(
代码示例来源:origin: net.consensys.cava/cava-rlpx
Bytes payloadMac = Bytes.wrap(new byte[16]);
macEncryptionEngine.processBlock(payloadMacSeed.toArrayUnsafe(), 0, payloadMac.toArrayUnsafe(), 0);
payloadMac = updateEgress(payloadMacSeed.xor(payloadMac)).slice(0, 16);
内容来源于网络,如有侵权,请联系作者删除!