net.consensys.cava.bytes.Bytes.xor()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中net.consensys.cava.bytes.Bytes.xor()方法的一些代码示例,展示了Bytes.xor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.xor()方法的具体详情如下:
包路径:net.consensys.cava.bytes.Bytes
类名称:Bytes
方法名:xor

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);

相关文章

微信公众号

最新文章

更多