1
0
mirror of https://github.com/fumiama/blake2b-simd.git synced 2026-06-11 13:40:27 +08:00

Removed functionality/code for comparing (during dev) to reference code

This commit is contained in:
frankw
2016-06-28 10:01:56 +02:00
parent 0cb28af64e
commit 1953a0fe1e
3 changed files with 5 additions and 1465 deletions

View File

@@ -34,7 +34,6 @@ type digest struct {
isKeyed bool // indicates whether hash was keyed
size uint8 // digest size in bytes
isLastNode bool // indicates processing of the last node in tree hashing
sseOptimized bool // temp bool to indicate use of SSE (during dev only)
}
// Initialization values.
@@ -163,12 +162,9 @@ func (d *digest) initialize(c *Config) {
}
// New512 returns a new hash.Hash computing the BLAKE2b 64-byte checksum.
func New512(enableSSE bool) hash.Hash {
func New512() hash.Hash {
d := new(digest)
d.initialize(defaultConfig)
if enableSSE {
d.EnableSSE()
}
return d
}
@@ -210,9 +206,6 @@ func (d *digest) Size() int { return int(d.size) }
// BlockSize returns the algorithm block size in bytes.
func (d *digest) BlockSize() int { return BlockSize }
// Enable SSE
func (d *digest) EnableSSE() { d.sseOptimized = true }
func (d *digest) Write(p []byte) (nn int, err error) {
nn = len(p)
left := BlockSize - d.nx
@@ -220,11 +213,7 @@ func (d *digest) Write(p []byte) (nn int, err error) {
// Process buffer.
copy(d.x[d.nx:], p[:left])
p = p[left:]
if d.sseOptimized {
compress(d, d.x[:])
} else {
blocks(d, d.x[:])
}
compress(d, d.x[:])
d.nx = 0
}
// Process full blocks except for the last one.
@@ -233,11 +222,7 @@ func (d *digest) Write(p []byte) (nn int, err error) {
if n == len(p) {
n -= BlockSize
}
if d.sseOptimized {
compress(d, p[:n])
} else {
blocks(d, p[:n])
}
compress(d, p[:n])
p = p[n:]
}
// Fill buffer.
@@ -277,11 +262,7 @@ func (d *digest) checkSum() [Size]byte {
d.f[1] = 0xffffffffffffffff
}
// Compress last block.
if d.sseOptimized {
compress(d, d.x[:])
} else {
blocks(d, d.x[:])
}
compress(d, d.x[:])
var out [Size]byte
j := 0