-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathareion_batched_fused.go
More file actions
69 lines (66 loc) · 2.22 KB
/
Copy pathareion_batched_fused.go
File metadata and controls
69 lines (66 loc) · 2.22 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package itb
import "github.com/everanium/itb/internal/areionasm"
// areionSoEM256BatchedFused evaluates the four lanes of the Areion-SoEM-256
// batched arm through the single-lane fused cascade kernel of
// internal/areionasm when an assembly tier is selected and the common
// lane length (the caller guards the equal-length contract) is one of
// the kernel shapes: one component
// group per lane is exactly one SoEM chain absorb keyed
// fixedKey ‖ seed, so the result is bit-exact with the single arm (the
// invariant the areionasm parity tests and the hashes known-answer
// vectors pin). false sends the caller to the four-way permutation
// path.
func areionSoEM256BatchedFused(fixedKey *[32]byte, seeds *[4][4]uint64, data *[4][]byte, commonLen int) (out [4][4]uint64, ok bool) {
if !areionasm.FusedAvailable() {
return out, false
}
switch commonLen {
case 13:
for lane := range out {
areionasm.Fused256Chain13x1(fixedKey, seeds[lane][:], &data[lane][0], &out[lane])
}
case 20:
for lane := range out {
areionasm.Fused256Chain20x1(fixedKey, seeds[lane][:], &data[lane][0], &out[lane])
}
case 36:
for lane := range out {
areionasm.Fused256Chain36x1(fixedKey, seeds[lane][:], &data[lane][0], &out[lane])
}
case 68:
for lane := range out {
areionasm.Fused256Chain68x1(fixedKey, seeds[lane][:], &data[lane][0], &out[lane])
}
default:
return out, false
}
return out, true
}
// areionSoEM512BatchedFused is the width-512 form of
// [areionSoEM256BatchedFused].
func areionSoEM512BatchedFused(fixedKey *[64]byte, seeds *[4][8]uint64, data *[4][]byte, commonLen int) (out [4][8]uint64, ok bool) {
if !areionasm.FusedAvailable() {
return out, false
}
switch commonLen {
case 13:
for lane := range out {
areionasm.Fused512Chain13x1(fixedKey, seeds[lane][:], &data[lane][0], &out[lane])
}
case 20:
for lane := range out {
areionasm.Fused512Chain20x1(fixedKey, seeds[lane][:], &data[lane][0], &out[lane])
}
case 36:
for lane := range out {
areionasm.Fused512Chain36x1(fixedKey, seeds[lane][:], &data[lane][0], &out[lane])
}
case 68:
for lane := range out {
areionasm.Fused512Chain68x1(fixedKey, seeds[lane][:], &data[lane][0], &out[lane])
}
default:
return out, false
}
return out, true
}