mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
Update blake2b_generic.go
This commit is contained in:
parent
2e5cd21edf
commit
8072451f67
1 changed files with 1 additions and 23 deletions
|
|
@ -4,10 +4,7 @@
|
|||
|
||||
package blake2b
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"math/bits"
|
||||
)
|
||||
import "math/bits"
|
||||
|
||||
// the precomputed values for BLAKE2b
|
||||
// there are 10 16-byte arrays - one for each round
|
||||
|
|
@ -25,25 +22,6 @@ var precomputed = [10][16]byte{
|
|||
{10, 8, 7, 1, 2, 4, 6, 5, 15, 9, 3, 13, 11, 14, 12, 0},
|
||||
}
|
||||
|
||||
// nolint:unused
|
||||
func hashBlocksGeneric(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) {
|
||||
var m [16]uint64
|
||||
c0, c1 := c[0], c[1]
|
||||
|
||||
for i := 0; i < len(blocks); {
|
||||
c0 += BlockSize
|
||||
if c0 < BlockSize {
|
||||
c1++
|
||||
}
|
||||
for j := range m {
|
||||
m[j] = binary.LittleEndian.Uint64(blocks[i:])
|
||||
i += 8
|
||||
}
|
||||
fGeneric(h, &m, c0, c1, flag, 12)
|
||||
}
|
||||
c[0], c[1] = c0, c1
|
||||
}
|
||||
|
||||
func fGeneric(h *[8]uint64, m *[16]uint64, c0, c1 uint64, flag uint64, rounds uint64) {
|
||||
v0, v1, v2, v3, v4, v5, v6, v7 := h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7]
|
||||
v8, v9, v10, v11, v12, v13, v14, v15 := iv[0], iv[1], iv[2], iv[3], iv[4], iv[5], iv[6], iv[7]
|
||||
|
|
|
|||
Loading…
Reference in a new issue