-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathitb3_ext_test.go
More file actions
1601 lines (1493 loc) · 61.2 KB
/
Copy pathitb3_ext_test.go
File metadata and controls
1601 lines (1493 loc) · 61.2 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Triple Ouroboros (8-seed) integration benchmarks driving the
// Encrypt3x{128,256,512}Cfg / Decrypt3x{128,256,512}Cfg entry
// points. Bench function names carry a "Triple" infix
// (BenchmarkExtTriple<Primitive>…).
//
// The hashes/Pair-factory makers (makeBlake2bHash256PairExt,
// makeAESCMACHash128PairExt, …) live in itb_ext_test.go and are
// reused verbatim here — package itb_test sees both files as the
// same compilation unit, so cross-file symbol reuse is free. Only
// helpers that are structurally Triple-specific (eight-seed
// constructors, the Encrypt3x / Decrypt3x bench drivers) and the
// benchmark functions themselves live in this file.
package itb_test
import (
"bytes"
"os"
"strconv"
"sync"
"testing"
"github.com/everanium/itb"
"github.com/everanium/itb/hashes"
"github.com/everanium/itb/triple"
)
// extTripleBenchCfg returns the *itb.Config every ExtTriple bench
// driver threads through the Cfg-suffixed entry points. The ITB_NONCE_BITS
// environment variable selects the nonce width (128 / 256 / 512); when
// unset or invalid the config pins the compile-in [itb.DefaultNonceBits]
// explicitly. The external test package cannot reach the root package's
// testCfg helper, so the env var is read here directly — same contract,
// same accepted values.
//
// The ITB_MAX_WORKERS environment variable pins the Low-Level worker
// cap ([itb.Config.MaxWorkers]) that every ExtTriple bench cell shares.
// Unset or 0 leaves the field at zero — the [runtime.NumCPU] default
// the Low-Level entry points fall back to; a positive integer clamps
// every bench cell to that worker count, so cross-host bench cells can
// be compared under an identical worker cap instead of each host's own
// core count.
func extTripleBenchCfg() *itb.Config {
cfg := &itb.Config{}
switch os.Getenv("ITB_NONCE_BITS") {
case "128":
cfg.NonceBits = 128
case "256":
cfg.NonceBits = 256
case "512":
cfg.NonceBits = 512
default:
cfg.NonceBits = itb.DefaultNonceBits
}
if v := os.Getenv("ITB_MAX_WORKERS"); v != "" {
if n, err := strconv.Atoi(v); err == nil && n >= 0 {
cfg.MaxWorkers = n
}
}
return cfg
}
// makeEightSeeds128Ext is the external-test counterpart of
// itb_test.go:makeEightSeeds128. Constructs the eight independent
// 128-bit ITB seeds the Triple Ouroboros API consumes (1 noise +
// 1 lockSeed + 3 data + 3 start), all bound to the same single-
// call hash function. The bench helpers below override per-seed
// Hash and BatchHash fields with fresh maker() pairs so each seed
// carries its own fixed key.
func makeEightSeeds128Ext(bits int, h itb.HashFunc128) (ns, ls, ds1, ds2, ds3, ss1, ss2, ss3 *itb.Seed128) {
ns, _ = itb.NewSeed128(bits, h)
ls, _ = itb.NewSeed128(bits, h)
ds1, _ = itb.NewSeed128(bits, h)
ds2, _ = itb.NewSeed128(bits, h)
ds3, _ = itb.NewSeed128(bits, h)
ss1, _ = itb.NewSeed128(bits, h)
ss2, _ = itb.NewSeed128(bits, h)
ss3, _ = itb.NewSeed128(bits, h)
return
}
// makeEightSeeds256Ext is the 256-bit counterpart.
func makeEightSeeds256Ext(bits int, h itb.HashFunc256) (ns, ls, ds1, ds2, ds3, ss1, ss2, ss3 *itb.Seed256) {
ns, _ = itb.NewSeed256(bits, h)
ls, _ = itb.NewSeed256(bits, h)
ds1, _ = itb.NewSeed256(bits, h)
ds2, _ = itb.NewSeed256(bits, h)
ds3, _ = itb.NewSeed256(bits, h)
ss1, _ = itb.NewSeed256(bits, h)
ss2, _ = itb.NewSeed256(bits, h)
ss3, _ = itb.NewSeed256(bits, h)
return
}
// makeEightSeeds512Ext is the 512-bit counterpart.
func makeEightSeeds512Ext(bits int, h itb.HashFunc512) (ns, ls, ds1, ds2, ds3, ss1, ss2, ss3 *itb.Seed512) {
ns, _ = itb.NewSeed512(bits, h)
ls, _ = itb.NewSeed512(bits, h)
ds1, _ = itb.NewSeed512(bits, h)
ds2, _ = itb.NewSeed512(bits, h)
ds3, _ = itb.NewSeed512(bits, h)
ss1, _ = itb.NewSeed512(bits, h)
ss2, _ = itb.NewSeed512(bits, h)
ss3, _ = itb.NewSeed512(bits, h)
return
}
// benchEncrypt3x128CachedBatchedExt mirrors itb_ext_test.go's
// benchEncrypt128CachedBatchedExt for the Triple Ouroboros API.
// The maker is invoked eight times so each of the eight seeds
// (noise + lock + 3 × data + 3 × start) carries its own fresh fixed
// key and (single, batched) pair; per-seed BatchHash is wired so
// itb.processChunk128 routes through the batched dispatch on every
// per-pixel hash call.
func benchEncrypt3x128CachedBatchedExt(b *testing.B, maker func() (itb.HashFunc128, itb.BatchHashFunc128), bits, dataSize int) {
nsH, nsB := maker()
ns, ls, ds1, ds2, ds3, ss1, ss2, ss3 := makeEightSeeds128Ext(bits, nsH)
ns.BatchHash = nsB
h, bf := maker()
ls.Hash, ls.BatchHash = h, bf
h, bf = maker()
ds1.Hash, ds1.BatchHash = h, bf
h, bf = maker()
ds2.Hash, ds2.BatchHash = h, bf
h, bf = maker()
ds3.Hash, ds3.BatchHash = h, bf
h, bf = maker()
ss1.Hash, ss1.BatchHash = h, bf
h, bf = maker()
ss2.Hash, ss2.BatchHash = h, bf
h, bf = maker()
ss3.Hash, ss3.BatchHash = h, bf
data := generateDataExt(dataSize)
cfg := extTripleBenchCfg()
b.SetBytes(int64(dataSize))
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = itb.Encrypt3x128Cfg(cfg, ns, ls, ds1, ds2, ds3, ss1, ss2, ss3, data)
}
}
func benchDecrypt3x128CachedBatchedExt(b *testing.B, maker func() (itb.HashFunc128, itb.BatchHashFunc128), bits, dataSize int) {
nsH, nsB := maker()
ns, ls, ds1, ds2, ds3, ss1, ss2, ss3 := makeEightSeeds128Ext(bits, nsH)
ns.BatchHash = nsB
h, bf := maker()
ls.Hash, ls.BatchHash = h, bf
h, bf = maker()
ds1.Hash, ds1.BatchHash = h, bf
h, bf = maker()
ds2.Hash, ds2.BatchHash = h, bf
h, bf = maker()
ds3.Hash, ds3.BatchHash = h, bf
h, bf = maker()
ss1.Hash, ss1.BatchHash = h, bf
h, bf = maker()
ss2.Hash, ss2.BatchHash = h, bf
h, bf = maker()
ss3.Hash, ss3.BatchHash = h, bf
data := generateDataExt(dataSize)
cfg := extTripleBenchCfg()
encrypted, _ := itb.Encrypt3x128Cfg(cfg, ns, ls, ds1, ds2, ds3, ss1, ss2, ss3, data)
b.SetBytes(int64(dataSize))
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = itb.Decrypt3x128Cfg(cfg, ns, ls, ds1, ds2, ds3, ss1, ss2, ss3, encrypted)
}
}
// benchEncrypt3x256CachedBatchedExt — Triple Ouroboros 256-bit
// counterpart. Mirrors benchEncrypt256CachedBatchedExt in
// itb_ext_test.go; same per-seed maker invocation pattern scaled
// to eight seeds.
func benchEncrypt3x256CachedBatchedExt(b *testing.B, maker func() (itb.HashFunc256, itb.BatchHashFunc256), bits, dataSize int) {
nsH, nsB := maker()
ns, ls, ds1, ds2, ds3, ss1, ss2, ss3 := makeEightSeeds256Ext(bits, nsH)
ns.BatchHash = nsB
h, bf := maker()
ls.Hash, ls.BatchHash = h, bf
h, bf = maker()
ds1.Hash, ds1.BatchHash = h, bf
h, bf = maker()
ds2.Hash, ds2.BatchHash = h, bf
h, bf = maker()
ds3.Hash, ds3.BatchHash = h, bf
h, bf = maker()
ss1.Hash, ss1.BatchHash = h, bf
h, bf = maker()
ss2.Hash, ss2.BatchHash = h, bf
h, bf = maker()
ss3.Hash, ss3.BatchHash = h, bf
data := generateDataExt(dataSize)
cfg := extTripleBenchCfg()
b.SetBytes(int64(dataSize))
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = itb.Encrypt3x256Cfg(cfg, ns, ls, ds1, ds2, ds3, ss1, ss2, ss3, data)
}
}
func benchDecrypt3x256CachedBatchedExt(b *testing.B, maker func() (itb.HashFunc256, itb.BatchHashFunc256), bits, dataSize int) {
nsH, nsB := maker()
ns, ls, ds1, ds2, ds3, ss1, ss2, ss3 := makeEightSeeds256Ext(bits, nsH)
ns.BatchHash = nsB
h, bf := maker()
ls.Hash, ls.BatchHash = h, bf
h, bf = maker()
ds1.Hash, ds1.BatchHash = h, bf
h, bf = maker()
ds2.Hash, ds2.BatchHash = h, bf
h, bf = maker()
ds3.Hash, ds3.BatchHash = h, bf
h, bf = maker()
ss1.Hash, ss1.BatchHash = h, bf
h, bf = maker()
ss2.Hash, ss2.BatchHash = h, bf
h, bf = maker()
ss3.Hash, ss3.BatchHash = h, bf
data := generateDataExt(dataSize)
cfg := extTripleBenchCfg()
encrypted, _ := itb.Encrypt3x256Cfg(cfg, ns, ls, ds1, ds2, ds3, ss1, ss2, ss3, data)
b.SetBytes(int64(dataSize))
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = itb.Decrypt3x256Cfg(cfg, ns, ls, ds1, ds2, ds3, ss1, ss2, ss3, encrypted)
}
}
// benchEncrypt3x512CachedBatchedExt — Triple Ouroboros 512-bit
// counterpart. Mirrors benchEncrypt512CachedBatchedExt in
// itb_ext_test.go.
func benchEncrypt3x512CachedBatchedExt(b *testing.B, maker func() (itb.HashFunc512, itb.BatchHashFunc512), bits, dataSize int) {
nsH, nsB := maker()
ns, ls, ds1, ds2, ds3, ss1, ss2, ss3 := makeEightSeeds512Ext(bits, nsH)
ns.BatchHash = nsB
h, bf := maker()
ls.Hash, ls.BatchHash = h, bf
h, bf = maker()
ds1.Hash, ds1.BatchHash = h, bf
h, bf = maker()
ds2.Hash, ds2.BatchHash = h, bf
h, bf = maker()
ds3.Hash, ds3.BatchHash = h, bf
h, bf = maker()
ss1.Hash, ss1.BatchHash = h, bf
h, bf = maker()
ss2.Hash, ss2.BatchHash = h, bf
h, bf = maker()
ss3.Hash, ss3.BatchHash = h, bf
data := generateDataExt(dataSize)
cfg := extTripleBenchCfg()
b.SetBytes(int64(dataSize))
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = itb.Encrypt3x512Cfg(cfg, ns, ls, ds1, ds2, ds3, ss1, ss2, ss3, data)
}
}
func benchDecrypt3x512CachedBatchedExt(b *testing.B, maker func() (itb.HashFunc512, itb.BatchHashFunc512), bits, dataSize int) {
nsH, nsB := maker()
ns, ls, ds1, ds2, ds3, ss1, ss2, ss3 := makeEightSeeds512Ext(bits, nsH)
ns.BatchHash = nsB
h, bf := maker()
ls.Hash, ls.BatchHash = h, bf
h, bf = maker()
ds1.Hash, ds1.BatchHash = h, bf
h, bf = maker()
ds2.Hash, ds2.BatchHash = h, bf
h, bf = maker()
ds3.Hash, ds3.BatchHash = h, bf
h, bf = maker()
ss1.Hash, ss1.BatchHash = h, bf
h, bf = maker()
ss2.Hash, ss2.BatchHash = h, bf
h, bf = maker()
ss3.Hash, ss3.BatchHash = h, bf
data := generateDataExt(dataSize)
cfg := extTripleBenchCfg()
encrypted, _ := itb.Encrypt3x512Cfg(cfg, ns, ls, ds1, ds2, ds3, ss1, ss2, ss3, data)
b.SetBytes(int64(dataSize))
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = itb.Decrypt3x512Cfg(cfg, ns, ls, ds1, ds2, ds3, ss1, ss2, ss3, encrypted)
}
}
// --- BLAKE2b-256 Triple Pair benches: 512-bit ITB width ---
func BenchmarkExtTripleBLAKE2b256_512bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE2b256, 512, 1<<20)
}
func BenchmarkExtTripleBLAKE2b256_512bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE2b256, 512, 16<<20)
}
func BenchmarkExtTripleBLAKE2b256_512bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE2b256, 512, 64<<20)
}
func BenchmarkExtTripleBLAKE2b256_512bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE2b256, 512, 1<<20)
}
func BenchmarkExtTripleBLAKE2b256_512bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE2b256, 512, 16<<20)
}
func BenchmarkExtTripleBLAKE2b256_512bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE2b256, 512, 64<<20)
}
// --- BLAKE2b-512 Triple Pair benches: 512-bit ITB width ---
func BenchmarkExtTripleBLAKE2b512_512bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x512HookedExt(b, hashes.CipherBLAKE2b512, 512, 1<<20)
}
func BenchmarkExtTripleBLAKE2b512_512bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x512HookedExt(b, hashes.CipherBLAKE2b512, 512, 16<<20)
}
func BenchmarkExtTripleBLAKE2b512_512bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x512HookedExt(b, hashes.CipherBLAKE2b512, 512, 64<<20)
}
func BenchmarkExtTripleBLAKE2b512_512bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x512HookedExt(b, hashes.CipherBLAKE2b512, 512, 1<<20)
}
func BenchmarkExtTripleBLAKE2b512_512bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x512HookedExt(b, hashes.CipherBLAKE2b512, 512, 16<<20)
}
func BenchmarkExtTripleBLAKE2b512_512bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x512HookedExt(b, hashes.CipherBLAKE2b512, 512, 64<<20)
}
// --- BLAKE2b-256 Triple Pair benches: 1024-bit ITB width ---
func BenchmarkExtTripleBLAKE2b256_1024bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE2b256, 1024, 1<<20)
}
func BenchmarkExtTripleBLAKE2b256_1024bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE2b256, 1024, 16<<20)
}
func BenchmarkExtTripleBLAKE2b256_1024bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE2b256, 1024, 64<<20)
}
func BenchmarkExtTripleBLAKE2b256_1024bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE2b256, 1024, 1<<20)
}
func BenchmarkExtTripleBLAKE2b256_1024bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE2b256, 1024, 16<<20)
}
func BenchmarkExtTripleBLAKE2b256_1024bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE2b256, 1024, 64<<20)
}
// --- BLAKE2b-512 Triple Pair benches: 1024-bit ITB width ---
func BenchmarkExtTripleBLAKE2b512_1024bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x512HookedExt(b, hashes.CipherBLAKE2b512, 1024, 1<<20)
}
func BenchmarkExtTripleBLAKE2b512_1024bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x512HookedExt(b, hashes.CipherBLAKE2b512, 1024, 16<<20)
}
func BenchmarkExtTripleBLAKE2b512_1024bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x512HookedExt(b, hashes.CipherBLAKE2b512, 1024, 64<<20)
}
func BenchmarkExtTripleBLAKE2b512_1024bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x512HookedExt(b, hashes.CipherBLAKE2b512, 1024, 1<<20)
}
func BenchmarkExtTripleBLAKE2b512_1024bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x512HookedExt(b, hashes.CipherBLAKE2b512, 1024, 16<<20)
}
func BenchmarkExtTripleBLAKE2b512_1024bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x512HookedExt(b, hashes.CipherBLAKE2b512, 1024, 64<<20)
}
// --- BLAKE2b-256 Triple Pair benches: 2048-bit ITB width ---
func BenchmarkExtTripleBLAKE2b256_2048bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE2b256, 2048, 1<<20)
}
func BenchmarkExtTripleBLAKE2b256_2048bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE2b256, 2048, 16<<20)
}
func BenchmarkExtTripleBLAKE2b256_2048bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE2b256, 2048, 64<<20)
}
func BenchmarkExtTripleBLAKE2b256_2048bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE2b256, 2048, 1<<20)
}
func BenchmarkExtTripleBLAKE2b256_2048bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE2b256, 2048, 16<<20)
}
func BenchmarkExtTripleBLAKE2b256_2048bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE2b256, 2048, 64<<20)
}
// --- BLAKE2b-512 Triple Pair benches: 2048-bit ITB width ---
func BenchmarkExtTripleBLAKE2b512_2048bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x512HookedExt(b, hashes.CipherBLAKE2b512, 2048, 1<<20)
}
func BenchmarkExtTripleBLAKE2b512_2048bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x512HookedExt(b, hashes.CipherBLAKE2b512, 2048, 16<<20)
}
func BenchmarkExtTripleBLAKE2b512_2048bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x512HookedExt(b, hashes.CipherBLAKE2b512, 2048, 64<<20)
}
func BenchmarkExtTripleBLAKE2b512_2048bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x512HookedExt(b, hashes.CipherBLAKE2b512, 2048, 1<<20)
}
func BenchmarkExtTripleBLAKE2b512_2048bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x512HookedExt(b, hashes.CipherBLAKE2b512, 2048, 16<<20)
}
func BenchmarkExtTripleBLAKE2b512_2048bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x512HookedExt(b, hashes.CipherBLAKE2b512, 2048, 64<<20)
}
// --- BLAKE2s-256 Triple Pair benches: 512-bit ITB width ---
func BenchmarkExtTripleBLAKE2s_512bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE2s, 512, 1<<20)
}
func BenchmarkExtTripleBLAKE2s_512bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE2s, 512, 16<<20)
}
func BenchmarkExtTripleBLAKE2s_512bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE2s, 512, 64<<20)
}
func BenchmarkExtTripleBLAKE2s_512bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE2s, 512, 1<<20)
}
func BenchmarkExtTripleBLAKE2s_512bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE2s, 512, 16<<20)
}
func BenchmarkExtTripleBLAKE2s_512bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE2s, 512, 64<<20)
}
// --- BLAKE2s-256 Triple Pair benches: 1024-bit ITB width ---
func BenchmarkExtTripleBLAKE2s_1024bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE2s, 1024, 1<<20)
}
func BenchmarkExtTripleBLAKE2s_1024bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE2s, 1024, 16<<20)
}
func BenchmarkExtTripleBLAKE2s_1024bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE2s, 1024, 64<<20)
}
func BenchmarkExtTripleBLAKE2s_1024bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE2s, 1024, 1<<20)
}
func BenchmarkExtTripleBLAKE2s_1024bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE2s, 1024, 16<<20)
}
func BenchmarkExtTripleBLAKE2s_1024bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE2s, 1024, 64<<20)
}
// --- BLAKE2s-256 Triple Pair benches: 2048-bit ITB width ---
func BenchmarkExtTripleBLAKE2s_2048bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE2s, 2048, 1<<20)
}
func BenchmarkExtTripleBLAKE2s_2048bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE2s, 2048, 16<<20)
}
func BenchmarkExtTripleBLAKE2s_2048bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE2s, 2048, 64<<20)
}
func BenchmarkExtTripleBLAKE2s_2048bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE2s, 2048, 1<<20)
}
func BenchmarkExtTripleBLAKE2s_2048bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE2s, 2048, 16<<20)
}
func BenchmarkExtTripleBLAKE2s_2048bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE2s, 2048, 64<<20)
}
// --- BLAKE3-256 Triple Pair benches: 512-bit ITB width ---
func BenchmarkExtTripleBLAKE3_512bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE3, 512, 1<<20)
}
func BenchmarkExtTripleBLAKE3_512bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE3, 512, 16<<20)
}
func BenchmarkExtTripleBLAKE3_512bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE3, 512, 64<<20)
}
func BenchmarkExtTripleBLAKE3_512bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE3, 512, 1<<20)
}
func BenchmarkExtTripleBLAKE3_512bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE3, 512, 16<<20)
}
func BenchmarkExtTripleBLAKE3_512bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE3, 512, 64<<20)
}
// --- BLAKE3-256 Triple Pair benches: 1024-bit ITB width ---
func BenchmarkExtTripleBLAKE3_1024bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE3, 1024, 1<<20)
}
func BenchmarkExtTripleBLAKE3_1024bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE3, 1024, 16<<20)
}
func BenchmarkExtTripleBLAKE3_1024bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE3, 1024, 64<<20)
}
func BenchmarkExtTripleBLAKE3_1024bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE3, 1024, 1<<20)
}
func BenchmarkExtTripleBLAKE3_1024bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE3, 1024, 16<<20)
}
func BenchmarkExtTripleBLAKE3_1024bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE3, 1024, 64<<20)
}
// --- BLAKE3-256 Triple Pair benches: 2048-bit ITB width ---
func BenchmarkExtTripleBLAKE3_2048bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE3, 2048, 1<<20)
}
func BenchmarkExtTripleBLAKE3_2048bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE3, 2048, 16<<20)
}
func BenchmarkExtTripleBLAKE3_2048bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherBLAKE3, 2048, 64<<20)
}
func BenchmarkExtTripleBLAKE3_2048bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE3, 2048, 1<<20)
}
func BenchmarkExtTripleBLAKE3_2048bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE3, 2048, 16<<20)
}
func BenchmarkExtTripleBLAKE3_2048bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherBLAKE3, 2048, 64<<20)
}
// --- ChaCha20-256 Triple Pair benches: 512-bit ITB width ---
func BenchmarkExtTripleChaCha20_512bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherChaCha20, 512, 1<<20)
}
func BenchmarkExtTripleChaCha20_512bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherChaCha20, 512, 16<<20)
}
func BenchmarkExtTripleChaCha20_512bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherChaCha20, 512, 64<<20)
}
func BenchmarkExtTripleChaCha20_512bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherChaCha20, 512, 1<<20)
}
func BenchmarkExtTripleChaCha20_512bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherChaCha20, 512, 16<<20)
}
func BenchmarkExtTripleChaCha20_512bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherChaCha20, 512, 64<<20)
}
// --- ChaCha20-256 Triple Pair benches: 1024-bit ITB width ---
func BenchmarkExtTripleChaCha20_1024bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherChaCha20, 1024, 1<<20)
}
func BenchmarkExtTripleChaCha20_1024bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherChaCha20, 1024, 16<<20)
}
func BenchmarkExtTripleChaCha20_1024bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherChaCha20, 1024, 64<<20)
}
func BenchmarkExtTripleChaCha20_1024bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherChaCha20, 1024, 1<<20)
}
func BenchmarkExtTripleChaCha20_1024bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherChaCha20, 1024, 16<<20)
}
func BenchmarkExtTripleChaCha20_1024bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherChaCha20, 1024, 64<<20)
}
// --- ChaCha20-256 Triple Pair benches: 2048-bit ITB width ---
func BenchmarkExtTripleChaCha20_2048bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherChaCha20, 2048, 1<<20)
}
func BenchmarkExtTripleChaCha20_2048bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherChaCha20, 2048, 16<<20)
}
func BenchmarkExtTripleChaCha20_2048bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherChaCha20, 2048, 64<<20)
}
func BenchmarkExtTripleChaCha20_2048bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherChaCha20, 2048, 1<<20)
}
func BenchmarkExtTripleChaCha20_2048bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherChaCha20, 2048, 16<<20)
}
func BenchmarkExtTripleChaCha20_2048bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherChaCha20, 2048, 64<<20)
}
// --- AES-CMAC-128 Triple Pair benches: 512-bit ITB width ---
func BenchmarkExtTripleAESCMAC_512bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x128HookedExt(b, hashes.CipherAES128CTR, 512, 1<<20)
}
func BenchmarkExtTripleAESCMAC_512bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x128HookedExt(b, hashes.CipherAES128CTR, 512, 16<<20)
}
func BenchmarkExtTripleAESCMAC_512bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x128HookedExt(b, hashes.CipherAES128CTR, 512, 64<<20)
}
func BenchmarkExtTripleAESCMAC_512bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x128HookedExt(b, hashes.CipherAES128CTR, 512, 1<<20)
}
func BenchmarkExtTripleAESCMAC_512bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x128HookedExt(b, hashes.CipherAES128CTR, 512, 16<<20)
}
func BenchmarkExtTripleAESCMAC_512bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x128HookedExt(b, hashes.CipherAES128CTR, 512, 64<<20)
}
// --- AES-CMAC-128 Triple Pair benches: 1024-bit ITB width ---
func BenchmarkExtTripleAESCMAC_1024bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x128HookedExt(b, hashes.CipherAES128CTR, 1024, 1<<20)
}
func BenchmarkExtTripleAESCMAC_1024bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x128HookedExt(b, hashes.CipherAES128CTR, 1024, 16<<20)
}
func BenchmarkExtTripleAESCMAC_1024bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x128HookedExt(b, hashes.CipherAES128CTR, 1024, 64<<20)
}
func BenchmarkExtTripleAESCMAC_1024bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x128HookedExt(b, hashes.CipherAES128CTR, 1024, 1<<20)
}
func BenchmarkExtTripleAESCMAC_1024bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x128HookedExt(b, hashes.CipherAES128CTR, 1024, 16<<20)
}
func BenchmarkExtTripleAESCMAC_1024bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x128HookedExt(b, hashes.CipherAES128CTR, 1024, 64<<20)
}
// --- AES-CMAC-128 Triple Pair benches: 2048-bit ITB width ---
func BenchmarkExtTripleAESCMAC_2048bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x128HookedExt(b, hashes.CipherAES128CTR, 2048, 1<<20)
}
func BenchmarkExtTripleAESCMAC_2048bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x128HookedExt(b, hashes.CipherAES128CTR, 2048, 16<<20)
}
func BenchmarkExtTripleAESCMAC_2048bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x128HookedExt(b, hashes.CipherAES128CTR, 2048, 64<<20)
}
func BenchmarkExtTripleAESCMAC_2048bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x128HookedExt(b, hashes.CipherAES128CTR, 2048, 1<<20)
}
func BenchmarkExtTripleAESCMAC_2048bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x128HookedExt(b, hashes.CipherAES128CTR, 2048, 16<<20)
}
func BenchmarkExtTripleAESCMAC_2048bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x128HookedExt(b, hashes.CipherAES128CTR, 2048, 64<<20)
}
// --- SipHash-2-4-128 Triple Pair benches: 512-bit ITB width ---
func BenchmarkExtTripleSipHash24_512bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x128HookedExt(b, hashes.CipherSipHash24, 512, 1<<20)
}
func BenchmarkExtTripleSipHash24_512bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x128HookedExt(b, hashes.CipherSipHash24, 512, 16<<20)
}
func BenchmarkExtTripleSipHash24_512bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x128HookedExt(b, hashes.CipherSipHash24, 512, 64<<20)
}
func BenchmarkExtTripleSipHash24_512bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x128HookedExt(b, hashes.CipherSipHash24, 512, 1<<20)
}
func BenchmarkExtTripleSipHash24_512bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x128HookedExt(b, hashes.CipherSipHash24, 512, 16<<20)
}
func BenchmarkExtTripleSipHash24_512bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x128HookedExt(b, hashes.CipherSipHash24, 512, 64<<20)
}
// --- SipHash-2-4-128 Triple Pair benches: 1024-bit ITB width ---
func BenchmarkExtTripleSipHash24_1024bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x128HookedExt(b, hashes.CipherSipHash24, 1024, 1<<20)
}
func BenchmarkExtTripleSipHash24_1024bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x128HookedExt(b, hashes.CipherSipHash24, 1024, 16<<20)
}
func BenchmarkExtTripleSipHash24_1024bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x128HookedExt(b, hashes.CipherSipHash24, 1024, 64<<20)
}
func BenchmarkExtTripleSipHash24_1024bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x128HookedExt(b, hashes.CipherSipHash24, 1024, 1<<20)
}
func BenchmarkExtTripleSipHash24_1024bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x128HookedExt(b, hashes.CipherSipHash24, 1024, 16<<20)
}
func BenchmarkExtTripleSipHash24_1024bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x128HookedExt(b, hashes.CipherSipHash24, 1024, 64<<20)
}
// --- SipHash-2-4-128 Triple Pair benches: 2048-bit ITB width ---
func BenchmarkExtTripleSipHash24_2048bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x128HookedExt(b, hashes.CipherSipHash24, 2048, 1<<20)
}
func BenchmarkExtTripleSipHash24_2048bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x128HookedExt(b, hashes.CipherSipHash24, 2048, 16<<20)
}
func BenchmarkExtTripleSipHash24_2048bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x128HookedExt(b, hashes.CipherSipHash24, 2048, 64<<20)
}
func BenchmarkExtTripleSipHash24_2048bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x128HookedExt(b, hashes.CipherSipHash24, 2048, 1<<20)
}
func BenchmarkExtTripleSipHash24_2048bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x128HookedExt(b, hashes.CipherSipHash24, 2048, 16<<20)
}
func BenchmarkExtTripleSipHash24_2048bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x128HookedExt(b, hashes.CipherSipHash24, 2048, 64<<20)
}
// --- Areion-SoEM-256 Triple Pair benches: 512-bit ITB width ---
func BenchmarkExtTripleAreion256_512bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherAreion256, 512, 1<<20)
}
func BenchmarkExtTripleAreion256_512bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherAreion256, 512, 16<<20)
}
func BenchmarkExtTripleAreion256_512bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherAreion256, 512, 64<<20)
}
func BenchmarkExtTripleAreion256_512bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherAreion256, 512, 1<<20)
}
func BenchmarkExtTripleAreion256_512bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherAreion256, 512, 16<<20)
}
func BenchmarkExtTripleAreion256_512bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherAreion256, 512, 64<<20)
}
// --- Areion-SoEM-512 Triple Pair benches: 512-bit ITB width ---
func BenchmarkExtTripleAreion512_512bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x512HookedExt(b, hashes.CipherAreion512, 512, 1<<20)
}
func BenchmarkExtTripleAreion512_512bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x512HookedExt(b, hashes.CipherAreion512, 512, 16<<20)
}
func BenchmarkExtTripleAreion512_512bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x512HookedExt(b, hashes.CipherAreion512, 512, 64<<20)
}
func BenchmarkExtTripleAreion512_512bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x512HookedExt(b, hashes.CipherAreion512, 512, 1<<20)
}
func BenchmarkExtTripleAreion512_512bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x512HookedExt(b, hashes.CipherAreion512, 512, 16<<20)
}
func BenchmarkExtTripleAreion512_512bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x512HookedExt(b, hashes.CipherAreion512, 512, 64<<20)
}
// --- Areion-SoEM-256 Triple Pair benches: 1024-bit ITB width ---
func BenchmarkExtTripleAreion256_1024bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherAreion256, 1024, 1<<20)
}
func BenchmarkExtTripleAreion256_1024bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherAreion256, 1024, 16<<20)
}
func BenchmarkExtTripleAreion256_1024bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherAreion256, 1024, 64<<20)
}
func BenchmarkExtTripleAreion256_1024bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherAreion256, 1024, 1<<20)
}
func BenchmarkExtTripleAreion256_1024bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherAreion256, 1024, 16<<20)
}
func BenchmarkExtTripleAreion256_1024bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherAreion256, 1024, 64<<20)
}
// --- Areion-SoEM-512 Triple Pair benches: 1024-bit ITB width ---
func BenchmarkExtTripleAreion512_1024bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x512HookedExt(b, hashes.CipherAreion512, 1024, 1<<20)
}
func BenchmarkExtTripleAreion512_1024bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x512HookedExt(b, hashes.CipherAreion512, 1024, 16<<20)
}
func BenchmarkExtTripleAreion512_1024bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x512HookedExt(b, hashes.CipherAreion512, 1024, 64<<20)
}
func BenchmarkExtTripleAreion512_1024bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x512HookedExt(b, hashes.CipherAreion512, 1024, 1<<20)
}
func BenchmarkExtTripleAreion512_1024bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x512HookedExt(b, hashes.CipherAreion512, 1024, 16<<20)
}
func BenchmarkExtTripleAreion512_1024bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x512HookedExt(b, hashes.CipherAreion512, 1024, 64<<20)
}
// --- Areion-SoEM-256 Triple Pair benches: 2048-bit ITB width ---
func BenchmarkExtTripleAreion256_2048bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherAreion256, 2048, 1<<20)
}
func BenchmarkExtTripleAreion256_2048bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherAreion256, 2048, 16<<20)
}
func BenchmarkExtTripleAreion256_2048bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x256HookedExt(b, hashes.CipherAreion256, 2048, 64<<20)
}
func BenchmarkExtTripleAreion256_2048bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherAreion256, 2048, 1<<20)
}
func BenchmarkExtTripleAreion256_2048bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherAreion256, 2048, 16<<20)
}
func BenchmarkExtTripleAreion256_2048bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x256HookedExt(b, hashes.CipherAreion256, 2048, 64<<20)
}
// --- Areion-SoEM-512 Triple Pair benches: 2048-bit ITB width ---
func BenchmarkExtTripleAreion512_2048bit_Encrypt_1MB(b *testing.B) {
benchEncrypt3x512HookedExt(b, hashes.CipherAreion512, 2048, 1<<20)
}
func BenchmarkExtTripleAreion512_2048bit_Encrypt_16MB(b *testing.B) {
benchEncrypt3x512HookedExt(b, hashes.CipherAreion512, 2048, 16<<20)
}
func BenchmarkExtTripleAreion512_2048bit_Encrypt_64MB(b *testing.B) {
benchEncrypt3x512HookedExt(b, hashes.CipherAreion512, 2048, 64<<20)
}
func BenchmarkExtTripleAreion512_2048bit_Decrypt_1MB(b *testing.B) {
benchDecrypt3x512HookedExt(b, hashes.CipherAreion512, 2048, 1<<20)
}
func BenchmarkExtTripleAreion512_2048bit_Decrypt_16MB(b *testing.B) {
benchDecrypt3x512HookedExt(b, hashes.CipherAreion512, 2048, 16<<20)
}
func BenchmarkExtTripleAreion512_2048bit_Decrypt_64MB(b *testing.B) {
benchDecrypt3x512HookedExt(b, hashes.CipherAreion512, 2048, 64<<20)
}
// --- Dedicated lockSeed coverage, Triple Ouroboros (BLAKE3 256-bit) ---
//
// The 48-bit interlock overlay is always engaged, so every Triple
// encrypt call consumes the lockSeed argument in the slot immediately
// after noiseSeed. Coverage focuses on the round-trip and the
// mixed-primitive path (lockSeed keyed by a different primitive than
// noiseSeed, exercising the algorithm-diversity defence-in-depth on
// the bit-permutation channel).
// TestTripleLockSeedRoundtrip256 verifies that Triple Ouroboros
// Encrypt3x / Decrypt3x round-trip succeeds with a dedicated
// lockSeed threaded through the 8-seed API.
func TestTripleLockSeedRoundtrip256(t *testing.T) {
ns := makeBlake3SeedAttachExt(t, 1024)
ls := makeBlake3SeedAttachExt(t, 1024)
ds1 := makeBlake3SeedAttachExt(t, 1024)
ds2 := makeBlake3SeedAttachExt(t, 1024)
ds3 := makeBlake3SeedAttachExt(t, 1024)
ss1 := makeBlake3SeedAttachExt(t, 1024)
ss2 := makeBlake3SeedAttachExt(t, 1024)
ss3 := makeBlake3SeedAttachExt(t, 1024)
plaintext := generateDataExt(1024)
ct, err := itb.Encrypt3x256Cfg(nil, ns, ls, ds1, ds2, ds3, ss1, ss2, ss3, plaintext)
if err != nil {
t.Fatalf("Encrypt3x256: %v", err)
}
pt, err := itb.Decrypt3x256Cfg(nil, ns, ls, ds1, ds2, ds3, ss1, ss2, ss3, ct)
if err != nil {
t.Fatalf("Decrypt3x256: %v", err)
}
if !bytes.Equal(pt, plaintext) {
t.Errorf("Triple lockSeed roundtrip mismatch: got %d bytes, want %d",
len(pt), len(plaintext))
}
}
// BenchmarkExtTripleBLAKE3RoundTripLockSeed measures the itb root
// Encrypt3x + Decrypt3x round-trip throughput and per-iteration
// allocation footprint under the 8-seed API. The configuration
// mirrors the realistic shape:
//
// - 1024-bit ITB key width (canonical mid-range).
// - 64 MiB plaintext (large enough that the per-pixel hash
// pipeline dominates and bench noise from the round-trip-
// framing overhead is negligible).
// - BLAKE3 keyed-hash primitive via [hashes.BLAKE3256Pair],
// which on amd64 + AVX-512 dispatches the batched arm to the
// fused ChainHash cascade kernels in
// hashes/internal/blake3asm. A fresh BLAKE3 fixed key is
// generated for each of the 8 seeds so all carry
// independent keying material.
//
// Run as:
//
// go test -bench=BenchmarkExtTripleBLAKE3RoundTripLockSeed \
// -benchmem -run=^$ -count=3 -benchtime=3x
func BenchmarkExtTripleBLAKE3RoundTripLockSeed(b *testing.B) {
const (
bits = 1024
dataSize = 64 << 20
)
mkSeed := func(role string) *itb.Seed256 {
h, bh, _ := hashes.BLAKE3256Pair()
s, err := itb.NewSeed256(bits, h)
if err != nil {
b.Fatalf("NewSeed256(%s): %v", role, err)
}
s.BatchHash = bh
return s
}
ns := mkSeed("noiseSeed")
ls := mkSeed("lockSeed")
ds1 := mkSeed("dataSeed1")
ds2 := mkSeed("dataSeed2")
ds3 := mkSeed("dataSeed3")
ss1 := mkSeed("startSeed1")
ss2 := mkSeed("startSeed2")
ss3 := mkSeed("startSeed3")
data := generateDataExt(dataSize)
b.SetBytes(int64(dataSize))
b.ResetTimer()
for i := 0; i < b.N; i++ {
encrypted, err := itb.Encrypt3x256Cfg(nil, ns, ls, ds1, ds2, ds3, ss1, ss2, ss3, data)
if err != nil {
b.Fatalf("Encrypt3x256: %v", err)
}
if _, err := itb.Decrypt3x256Cfg(nil, ns, ls, ds1, ds2, ds3, ss1, ss2, ss3, encrypted); err != nil {
b.Fatalf("Decrypt3x256: %v", err)
}
}
}
// TestTripleLockSeedMixedPrimitive256 verifies that Triple round-trip
// succeeds with a BLAKE2s-keyed lockSeed alongside a BLAKE3-keyed
// noiseSeed (and BLAKE3 across the 3 dataSeeds + 3 startSeeds). The
// Triple build-PRF closure captures the lockSeed's Hash, so the
// bit-permutation overlay observably runs through the lockSeed
// primitive while the noise-injection channel runs through the
// noiseSeed primitive.
func TestTripleLockSeedMixedPrimitive256(t *testing.T) {
ns := makeBlake3SeedAttachExt(t, 1024)
ds1 := makeBlake3SeedAttachExt(t, 1024)
ds2 := makeBlake3SeedAttachExt(t, 1024)
ds3 := makeBlake3SeedAttachExt(t, 1024)
ss1 := makeBlake3SeedAttachExt(t, 1024)
ss2 := makeBlake3SeedAttachExt(t, 1024)
ss3 := makeBlake3SeedAttachExt(t, 1024)
hL, bL, _ := hashes.BLAKE2s256Pair()
ls, err := itb.NewSeed256(1024, hL)
if err != nil {
t.Fatalf("NewSeed256 (BLAKE2s lockSeed): %v", err)
}
ls.BatchHash = bL
plaintext := generateDataExt(2048)
ct, err := itb.Encrypt3x256Cfg(nil, ns, ls, ds1, ds2, ds3, ss1, ss2, ss3, plaintext)
if err != nil {
t.Fatalf("Encrypt3x256 (mixed-primitive lockSeed): %v", err)
}
pt, err := itb.Decrypt3x256Cfg(nil, ns, ls, ds1, ds2, ds3, ss1, ss2, ss3, ct)
if err != nil {
t.Fatalf("Decrypt3x256 (mixed-primitive lockSeed): %v", err)
}
if !bytes.Equal(pt, plaintext) {
t.Errorf("Triple mixed-primitive lockSeed roundtrip mismatch: got %d bytes, want %d",
len(pt), len(plaintext))
}
}
// --- Fleet-shape benches: triple facade Pipeline, binding-comparable ---
//
// The BenchmarkFleetGoNative_* cohort measures the Go-native triple
// facade at the exact layer the binding shims drive: profile-based
// [triple.Init] plus [triple.Pipeline.EncryptMessage] /
// [triple.Pipeline.DecryptMessage] / [triple.Pipeline.EncryptStream] /
// [triple.Pipeline.DecryptStream]. The numbers are therefore directly
// comparable with binding-fleet bench output minus the FFI hop. Two
// configurations, matching the binding-fleet bench shape:
//
// - Canonical: No MAC profiles (Single Message / Streaming
// Non-AEAD), parallax off, wrapper off — the fair-comparison
// floor every binding bench targets by default.
// - Production: MAC profiles (Single Message MAC / Streaming AEAD),
// parallax on, wrapper on — the shipped production shape.