1
0
mirror of https://github.com/fumiama/blake2b-simd.git synced 2026-06-12 06:00:31 +08:00

First half of G1 macro working for Round 1

This commit is contained in:
frankw
2016-06-24 22:14:06 +02:00
parent 8bc3dcee2c
commit 207d895ad9
3 changed files with 50 additions and 19 deletions

View File

@@ -20,7 +20,7 @@
package blake2b
//go:noescape
func compressSSE(p []uint8, in, iv, t, f, out []uint64)
func compressSSE(p []uint8, in, iv , t, f, shffle, out []uint64)
func compress(d *digest, p []uint8) {
h0, h1, h2, h3, h4, h5, h6, h7 := d.h[0], d.h[1], d.h[2], d.h[3], d.h[4], d.h[5], d.h[6], d.h[7]
@@ -28,6 +28,11 @@ func compress(d *digest, p []uint8) {
in := make([]uint64, 8, 8)
out := make([]uint64, 8, 8)
shffle := make([]uint64, 2, 2)
// vector for PSHUFB instruction
shffle[0] = 0x0201000706050403
shffle[1] = 0x0a09080f0e0d0c0b
for len(p) >= BlockSize {
// Increment counter.
d.t[0] += BlockSize
@@ -37,7 +42,7 @@ func compress(d *digest, p []uint8) {
in[0], in[1], in[2], in[3], in[4], in[5], in[6], in[7] = h0, h1, h2, h3, h4, h5, h6, h7
compressSSE(p, in, iv[:], d.t[:], d.f[:], out)
compressSSE(p, in, iv[:], d.t[:], d.f[:], shffle, out)
h0, h1, h2, h3, h4, h5, h6, h7 = out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7]