mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
swarm/storage/encryption: address review comments
This commit is contained in:
parent
855c1247c1
commit
f7da05fd78
3 changed files with 9 additions and 10 deletions
|
|
@ -89,7 +89,7 @@ func (e *encryption) transform(in, out []byte) {
|
||||||
// call transformations per segment (asyncronously)
|
// call transformations per segment (asyncronously)
|
||||||
go func(i int, x, y []byte) {
|
go func(i int, x, y []byte) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
e.transcrypt(i, x, y)
|
e.Transcrypt(i, x, y)
|
||||||
}(i/e.keyLen, in[i:i+l], out[i:i+l])
|
}(i/e.keyLen, in[i:i+l], out[i:i+l])
|
||||||
}
|
}
|
||||||
// pad the rest if out is longer
|
// pad the rest if out is longer
|
||||||
|
|
@ -99,7 +99,7 @@ func (e *encryption) transform(in, out []byte) {
|
||||||
|
|
||||||
// used for segmentwise transformation
|
// used for segmentwise transformation
|
||||||
// if in is shorter than out, padding is used
|
// if in is shorter than out, padding is used
|
||||||
func (e *encryption) transcrypt(i int, in []byte, out []byte) {
|
func (e *encryption) Transcrypt(i int, in []byte, out []byte) {
|
||||||
// first hash key with counter (initial counter + i)
|
// first hash key with counter (initial counter + i)
|
||||||
hasher := e.hashFunc()
|
hasher := e.hashFunc()
|
||||||
hasher.Write(e.key)
|
hasher.Write(e.key)
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -31,7 +31,6 @@ type hasherStore struct {
|
||||||
toEncrypt bool
|
toEncrypt bool
|
||||||
hashFunc SwarmHasher
|
hashFunc SwarmHasher
|
||||||
hashSize int // content hash size
|
hashSize int // content hash size
|
||||||
chunkSize int64 // max size of chunk
|
|
||||||
refSize int64 // reference size (content hash + possibly encryption key)
|
refSize int64 // reference size (content hash + possibly encryption key)
|
||||||
wg *sync.WaitGroup
|
wg *sync.WaitGroup
|
||||||
closed chan struct{}
|
closed chan struct{}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue