File: hash_arm.go

package info (click to toggle)
golang-siphash-dev 1.2.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 152 kB
  • sloc: asm: 641; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 513 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//go:build arm
// +build arm

package siphash

// NB: ARM implementation of forgoes extra speed for Hash()
// and Hash128() by simply reusing the same blocks() implementation
// in assembly used by the streaming hash.

func Hash(k0, k1 uint64, p []byte) uint64 {
	var d digest
	d.size = Size
	d.k0 = k0
	d.k1 = k1
	d.Reset()
	d.Write(p)
	return d.Sum64()
}

func Hash128(k0, k1 uint64, p []byte) (uint64, uint64) {
	var d digest
	d.size = Size128
	d.k0 = k0
	d.k1 = k1
	d.Reset()
	d.Write(p)
	return d.sum128()
}