Parcourir la source

sha3: simplifies Read function

pull/47/head
Henry Case il y a 4 ans
Parent
révision
bd23898fdb
1 fichiers modifiés avec 4 ajouts et 9 suppressions
  1. +4
    -9
      hash/sha3/sha3.go

+ 4
- 9
hash/sha3/sha3.go Voir le fichier

@@ -179,22 +179,17 @@ func (c *state) Read(out []byte) (nread int, err error) {
// copy out full blocks and squeeze. at this point
// there is no more data in the buffer.
nblocks := l / rate
for i := 0; i < nblocks; i++ {
for nblocks > 0 {
keccakF1600(&c.a)
copyOut(c, out[:rate])
out = out[rate:]
}

// produce more if needed
l = len(out)
if l == 0 {
return nread, nil
nblocks--
}

keccakF1600(&c.a)
copyOut(c, buf)
copy(out, buf[:l])
c.idx = rate - l
copy(out, buf[:len(out)])
c.idx = rate - len(out)
return nread, nil
}



Chargement…
Annuler
Enregistrer