mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
p2p/rlpx: optimize XOR operation using bitutil.XORBytes
This commit is contained in:
parent
e94123acc2
commit
efa19990d5
1 changed files with 2 additions and 3 deletions
|
|
@ -38,6 +38,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
"github.com/golang/snappy"
|
"github.com/golang/snappy"
|
||||||
"golang.org/x/crypto/sha3"
|
"golang.org/x/crypto/sha3"
|
||||||
|
"github.com/ethereum/go-ethereum/common/bitutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Conn is an RLPx network connection. It wraps a low-level network connection. The
|
// Conn is an RLPx network connection. It wraps a low-level network connection. The
|
||||||
|
|
@ -676,8 +677,6 @@ func exportPubkey(pub *ecies.PublicKey) []byte {
|
||||||
|
|
||||||
func xor(one, other []byte) (xor []byte) {
|
func xor(one, other []byte) (xor []byte) {
|
||||||
xor = make([]byte, len(one))
|
xor = make([]byte, len(one))
|
||||||
for i := 0; i < len(one); i++ {
|
bitutil.XORBytes(xor, one, other)
|
||||||
xor[i] = one[i] ^ other[i]
|
|
||||||
}
|
|
||||||
return xor
|
return xor
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue