mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 01:43:47 +00:00
swarm/storage/encryption: Calculate segmentSize only once
This commit is contained in:
parent
38a2af167f
commit
f9803b468b
1 changed files with 2 additions and 1 deletions
|
|
@ -91,7 +91,8 @@ func (e *encryption) transform(data []byte, key Key) []byte {
|
||||||
|
|
||||||
hasher.Reset()
|
hasher.Reset()
|
||||||
|
|
||||||
for j := 0; j < min(hashSize, dataLength-i); j++ {
|
segmentSize := min(hashSize, dataLength-i)
|
||||||
|
for j := 0; j < segmentSize; j++ {
|
||||||
transformedData[i+j] = data[i+j] ^ segmentKey[j]
|
transformedData[i+j] = data[i+j] ^ segmentKey[j]
|
||||||
}
|
}
|
||||||
ctr++
|
ctr++
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue