libkeccak_3.0.0_f33be1c8/tests/benchmark/src/common/benchmark.adb

  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
-------------------------------------------------------------------------------
--  Copyright (c) 2016, Daniel King
--  All rights reserved.
--
--  Redistribution and use in source and binary forms, with or without
--  modification, are permitted provided that the following conditions are met:
--      * Redistributions of source code must retain the above copyright
--        notice, this list of conditions and the following disclaimer.
--      * Redistributions in binary form must reproduce the above copyright
--        notice, this list of conditions and the following disclaimer in the
--        documentation and/or other materials provided with the distribution.
--      * The name of the copyright holder may not be used to endorse or promote
--        Products derived from this software without specific prior written
--        permission.
--
--  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
--  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
--  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
--  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
--  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
--  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
--  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
--  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------

with Timing;                        use Timing;
with Ada.Text_IO;                   use Ada.Text_IO;
with Ada.Integer_Text_IO;
with Ada.Long_Float_Text_IO;
with Interfaces;                    use Interfaces;
with KangarooTwelve;
with MarsupilamiFourteen;
with Keccak.Parallel_Keccak_1600;
with Keccak.Parallel_Keccak_1600.Rounds_24;
with Keccak.Parallel_Keccak_1600.Rounds_12;
with Keccak.Generic_KangarooTwelve;
with Keccak.Generic_MonkeyWrap;
with Keccak.Generic_Parallel_Hash;
with Keccak.Keccak_25;
with Keccak.Keccak_25.Rounds_12;
with Keccak.Keccak_50;
with Keccak.Keccak_50.Rounds_14;
with Keccak.Keccak_100;
with Keccak.Keccak_100.Rounds_16;
with Keccak.Keccak_200;
with Keccak.Keccak_200.Rounds_18;
with Keccak.Keccak_400;
with Keccak.Keccak_400.Rounds_20;
with Keccak.Keccak_800;
with Keccak.Keccak_800.Rounds_22;
with Keccak.Keccak_1600;
with Keccak.Keccak_1600.Rounds_24;
with Keccak.Keccak_1600.Rounds_12;
with Keccak.Types;
with Keccak.Generic_XOF;
with Keccak.Generic_Hash;
with Keccak.Generic_Duplex;
with Parallel_Hash;
with SHA3;
with SHAKE;
with RawSHAKE;
with Ketje;
with Gimli;
with Gimli.Hash;
with Ascon;
with Ascon.Permutations;
with Ascon.Hash;

procedure Benchmark
is
   Benchmark_Data_Size : constant := 512 * 1024; --  size of the benchmark data in bytes
   Repeat              : constant := 200;  --  number of benchmark iterations

   --  Use a 1 MiB data chunk as an input to the algorithms.
   --  A separate buffer is used as an output buffer for Ketje to avoid aliasing.
   type Byte_Array_Access is access Keccak.Types.Byte_Array;

   Data_Chunk_1 : constant Byte_Array_Access :=
     new Keccak.Types.Byte_Array (1 .. Benchmark_Data_Size);

   Data_Chunk_2 : constant Byte_Array_Access :=
     new Keccak.Types.Byte_Array (1 .. Benchmark_Data_Size);

   package Cycles_Count_IO is new Ada.Text_IO.Modular_IO (Cycles_Count);

   ---------------------------
   -- Print_Cycles_Per_Byte --
   ---------------------------

   procedure Print_Cycles_Per_Byte (Data_Size : in Natural;
                                    Cycles    : in Cycles_Count)
   is
      CPB : Long_Float;

   begin
      CPB := Long_Float (Cycles) / Long_Float (Data_Size);

      Ada.Long_Float_Text_IO.Put
        (Item => CPB,
         Fore => 0,
         Aft  => 1,
         Exp  => 0);

      Ada.Text_IO.Put (" cycles/byte");
      Ada.Text_IO.New_Line;
   end Print_Cycles_Per_Byte;

   ------------------
   -- Print_Cycles --
   ------------------

   procedure Print_Cycles (Cycles : in Cycles_Count)
   is
   begin
      Cycles_Count_IO.Put (Cycles, Width => 0);
      Ada.Text_IO.Put (" cycles");
      Ada.Text_IO.New_Line;
   end Print_Cycles;

   ----------------------------------------------------------------------------
   --  Hash_Benchmark
   --
   --  Generic procedure to run a benchmark for any hash algorithm (e.g. SHA3-224,
   --  Keccak-256, etc...).
   ----------------------------------------------------------------------------

   generic
       Name : String;
       with package Hash_Package is new Keccak.Generic_Hash (<>);
   procedure Hash_Benchmark;

   procedure Hash_Benchmark
   is
      Ctx   : Hash_Package.Context;
      Digest : Hash_Package.Digest_Type;

      Start_Time : Timing.Time;
      Cycles     : Cycles_Count;
      Min_Cycles : Cycles_Count := Cycles_Count'Last;

   begin
      Ada.Text_IO.Put (Name & ": ");

      Timing.Calibrate;

      for I in Positive range 1 .. Repeat loop
         Start_Measurement (Start_Time);

         Hash_Package.Init (Ctx);

         Hash_Package.Update (Ctx, Data_Chunk_1.all, Data_Chunk_1.all'Length * 8);

         Hash_Package.Final (Ctx, Digest);

         Cycles := End_Measurement (Start_Time);

         if Cycles < Min_Cycles then
            Min_Cycles := Cycles;
         end if;
      end loop;

      Print_Cycles_Per_Byte (Data_Chunk_1.all'Length, Min_Cycles);
   end Hash_Benchmark;

   ----------------------------------------------------------------------------
   --  XOF_Benchmark
   --
   --  Generic procedure to run a benchmark for any XOF algorithm (e.g. SHAKE128,
   --  RawSHAKE256, etc...).
   ----------------------------------------------------------------------------
   generic
       Name : String;
       with package XOF_Package is new Keccak.Generic_XOF (<>);
   procedure XOF_Benchmark;

   procedure XOF_Benchmark
   is
      Ctx    : XOF_Package.Context;

      Start_Time : Timing.Time;
      Cycles     : Cycles_Count;
      Min_Cycles : Cycles_Count := Cycles_Count'Last;

   begin
      Ada.Text_IO.Put (Name & " (Absorbing): ");

      Timing.Calibrate;

      --  Benchmark Absorbing
      for I in Positive range 1 .. Repeat loop
         Start_Measurement (Start_Time);

         XOF_Package.Init (Ctx);

         XOF_Package.Update (Ctx, Data_Chunk_1.all, Data_Chunk_1.all'Length * 8);

         Cycles := End_Measurement (Start_Time);

         if Cycles < Min_Cycles then
            Min_Cycles := Cycles;
         end if;
      end loop;

      Print_Cycles_Per_Byte (Data_Chunk_1.all'Length, Min_Cycles);

      Min_Cycles := Cycles_Count'Last;

      Ada.Text_IO.Put (Name & " (Squeezing): ");

      Timing.Calibrate;

      --  Benchmark squeezing
      for I in Positive range 1 .. Repeat loop
         Start_Measurement (Start_Time);

         XOF_Package.Extract (Ctx, Data_Chunk_1.all);

         Cycles := End_Measurement (Start_Time);

         if Cycles < Min_Cycles then
            Min_Cycles := Cycles;
         end if;
      end loop;

      Print_Cycles_Per_Byte (Data_Chunk_1.all'Length, Min_Cycles);
   end XOF_Benchmark;

   ----------------------------------------------------------------------------
   --  Duplex_Benchmark
   --
   --  Generic procedure to run a benchmark for any Duplex algorithm.
   ----------------------------------------------------------------------------
   generic
      Name : String;
      Capacity : Positive;
      with package Duplex is new Keccak.Generic_Duplex (<>);
   procedure Duplex_Benchmark;

   procedure Duplex_Benchmark
   is
      Ctx : Duplex.Context;

      Out_Data : Keccak.Types.Byte_Array (1 .. 1600 / 8);

      Start_Time : Timing.Time;
      Cycles     : Cycles_Count;
      Min_Cycles : Cycles_Count := Cycles_Count'Last;

   begin
      Ada.Text_IO.Put (Name & ": ");

      Duplex.Init (Ctx, Capacity);

      Timing.Calibrate;

      for I in Positive range 1 .. Repeat loop
         Start_Measurement (Start_Time);

         Duplex.Duplex (Ctx,
                        Data_Chunk_1.all (1 .. Duplex.Rate_Of (Ctx) / 8),
                        Duplex.Rate_Of (Ctx) - Duplex.Min_Padding_Bits,
                        Out_Data (1 .. Duplex.Rate_Of (Ctx) / 8),
                        Duplex.Rate_Of (Ctx) - Duplex.Min_Padding_Bits);

         Cycles := End_Measurement (Start_Time);

         if Cycles < Min_Cycles then
            Min_Cycles := Cycles;
         end if;
      end loop;

      Print_Cycles (Min_Cycles);

   end Duplex_Benchmark;

   ----------------------------------------------------------------------------
   --  KeccakF_Benchmark
   --
   --  Generic procedure to run a benchmark for a KeccakF permutation.
   ----------------------------------------------------------------------------
   generic
      Name : String;
      type State_Type is private;
      with procedure Init (A : out State_Type);
      with procedure Permute (A : in out State_Type);
   procedure KeccakF_Benchmark;

   procedure KeccakF_Benchmark
   is
      State : State_Type;

      Start_Time : Timing.Time;
      Cycles     : Cycles_Count;
      Min_Cycles : Cycles_Count := Cycles_Count'Last;

      Num_Iterations : constant Natural := Repeat * 100;

   begin
      Ada.Text_IO.Put (Name & ": ");

      Init (State);

      Timing.Calibrate;

      for I in Positive range 1 .. Num_Iterations loop
         Start_Measurement (Start_Time);

         Permute (State);

         Cycles := End_Measurement (Start_Time);

         if Cycles < Min_Cycles then
            Min_Cycles := Cycles;
         end if;
      end loop;

      Print_Cycles (Min_Cycles);

   end KeccakF_Benchmark;

   ----------------------------------------------------------------------------
   --  K12_Benchmark
   --
   --  Generic procedure to run a benchmark for a KangarooTwelve
   ----------------------------------------------------------------------------
   generic
      Name : String;
      with package K12 is new Keccak.Generic_KangarooTwelve (<>);
   procedure K12_Benchmark;

   procedure K12_Benchmark
   is
      Ctx    : K12.Context;

      Start_Time : Timing.Time;
      Cycles     : Cycles_Count;
      Min_Cycles : Cycles_Count := Cycles_Count'Last;

   begin
      Ada.Text_IO.Put (Name & " (Absorbing): ");

      Timing.Calibrate;

      --  Benchmark Absorbing
      for I in Positive range 1 .. Repeat loop
         Start_Measurement (Start_Time);

         K12.Init (Ctx);

         K12.Update (Ctx, Data_Chunk_1.all);

         K12.Finish (Ctx, "");

         Cycles := End_Measurement (Start_Time);

         if Cycles < Min_Cycles then
            Min_Cycles := Cycles;
         end if;
      end loop;

      Print_Cycles_Per_Byte (Data_Chunk_1.all'Length, Min_Cycles);

      Min_Cycles := Cycles_Count'Last;
      Ada.Text_IO.Put (Name & " (Squeezing): ");

      Timing.Calibrate;

      --  Benchmark squeezing
      for I in Positive range 1 .. Repeat loop
         Start_Measurement (Start_Time);

         K12.Extract (Ctx, Data_Chunk_1.all);

         Cycles := End_Measurement (Start_Time);

         if Cycles < Min_Cycles then
            Min_Cycles := Cycles;
         end if;
      end loop;

      Print_Cycles_Per_Byte (Data_Chunk_1.all'Length, Min_Cycles);
   end K12_Benchmark;

   ----------------------------------------------------------------------------
   --  ParallelHash_Benchmark
   --
   --  Generic procedure to run a benchmark for a ParallelHash
   ----------------------------------------------------------------------------
   generic
      Name : String;
      with package ParallelHash is new Keccak.Generic_Parallel_Hash (<>);
   procedure ParallelHash_Benchmark;

   procedure ParallelHash_Benchmark
   is
      Ctx    : ParallelHash.Context;

      Start_Time : Timing.Time;
      Cycles     : Cycles_Count;
      Min_Cycles : Cycles_Count := Cycles_Count'Last;

   begin
      Ada.Text_IO.Put (Name & " (Absorbing): ");

      Timing.Calibrate;

      --  Benchmark Absorbing
      for I in Positive range 1 .. Repeat loop
         Start_Measurement (Start_Time);

         ParallelHash.Init (Ctx, 8192, "");

         ParallelHash.Update (Ctx, Data_Chunk_1.all);

         Cycles := End_Measurement (Start_Time);

         if Cycles < Min_Cycles then
            Min_Cycles := Cycles;
         end if;
      end loop;

      Print_Cycles_Per_Byte (Data_Chunk_1.all'Length, Min_Cycles);

      Min_Cycles := Cycles_Count'Last;
      Ada.Text_IO.Put (Name & " (Squeezing): ");

      Timing.Calibrate;

      --  Benchmark squeezing
      for I in Positive range 1 .. Repeat loop
         Start_Measurement (Start_Time);

         ParallelHash.Extract (Ctx, Data_Chunk_1.all);

         Cycles := End_Measurement (Start_Time);

         if Cycles < Min_Cycles then
            Min_Cycles := Cycles;
         end if;
      end loop;

      Print_Cycles_Per_Byte (Data_Chunk_1.all'Length, Min_Cycles);
   end ParallelHash_Benchmark;

   ----------------------------------------------------------------------------
   --  Ketje_Benchmark
   --
   --  Generic procedure to run a benchmark for Ketje (instances of MonkeyWrap)
   ----------------------------------------------------------------------------
   generic
      Name : String;
      with package MonkeyWrap is new Keccak.Generic_MonkeyWrap (<>);
   procedure Ketje_Benchmark;

   procedure Ketje_Benchmark
   is
      Ctx    : MonkeyWrap.Context;

      Start_Time : Timing.Time;
      Cycles     : Cycles_Count;
      Min_Cycles : Cycles_Count := Cycles_Count'Last;

      Empty : constant Keccak.Types.Byte_Array (1 .. 0) := (others => 0);

   begin
      Ada.Text_IO.Put (Name & " (AAD): ");

      Timing.Calibrate;

      --  Benchmark AAD
      for I in Positive range 1 .. Repeat loop
         MonkeyWrap.Init (Ctx, Empty, Empty);

         Start_Measurement (Start_Time);

         MonkeyWrap.Update_Auth_Data (Ctx, Data_Chunk_1.all);

         Cycles := End_Measurement (Start_Time);

         if Cycles < Min_Cycles then
            Min_Cycles := Cycles;
         end if;
      end loop;

      Print_Cycles_Per_Byte (Data_Chunk_1.all'Length, Min_Cycles);

      Min_Cycles := Cycles_Count'Last;
      Ada.Text_IO.Put (Name & " (Encrypt): ");

      Timing.Calibrate;

      --  Benchmark Encrypt
      for I in Positive range 1 .. Repeat loop
         MonkeyWrap.Init (Ctx, Empty, Empty);

         Start_Measurement (Start_Time);

         MonkeyWrap.Update_Encrypt (Ctx, Data_Chunk_1.all, Data_Chunk_2.all);

         Cycles := End_Measurement (Start_Time);

         if Cycles < Min_Cycles then
            Min_Cycles := Cycles;
         end if;
      end loop;

      Print_Cycles_Per_Byte (Data_Chunk_1.all'Length, Min_Cycles);
      Ada.Text_IO.Put (Name & " (Decrypt): ");

      --  Benchmark Decrypt
      for I in Positive range 1 .. Repeat loop
         MonkeyWrap.Init (Ctx, Empty, Empty);

         Start_Measurement (Start_Time);

         MonkeyWrap.Update_Decrypt (Ctx, Data_Chunk_1.all, Data_Chunk_2.all);

         Cycles := End_Measurement (Start_Time);

         if Cycles < Min_Cycles then
            Min_Cycles := Cycles;
         end if;
      end loop;

      Print_Cycles_Per_Byte (Data_Chunk_1.all'Length, Min_Cycles);
      Ada.Text_IO.Put (Name & " (Tag): ");

      --  Benchmark Tag
      for I in Positive range 1 .. Repeat loop
         MonkeyWrap.Init (Ctx, Empty, Empty);

         Start_Measurement (Start_Time);

         MonkeyWrap.Extract_Tag (Ctx, Data_Chunk_1.all);

         Cycles := End_Measurement (Start_Time);

         if Cycles < Min_Cycles then
            Min_Cycles := Cycles;
         end if;
      end loop;

      Print_Cycles_Per_Byte (Data_Chunk_1.all'Length, Min_Cycles);

   end Ketje_Benchmark;

   ----------------------------------------------------------------------------
   --  Benchmark procedure instantiations.
   ----------------------------------------------------------------------------

   procedure Benchmark_SHA_224 is new Hash_Benchmark
      ("SHA3-224", SHA3.SHA3_224);
   procedure Benchmark_SHA_256 is new Hash_Benchmark
      ("SHA3-256", SHA3.SHA3_256);
   procedure Benchmark_SHA_384 is new Hash_Benchmark
      ("SHA3-384", SHA3.SHA3_384);
   procedure Benchmark_SHA_512 is new Hash_Benchmark
      ("SHA3-512", SHA3.SHA3_512);

   procedure Benchmark_Keccak_224 is new Hash_Benchmark
      ("Keccak-224", SHA3.Keccak_224);
   procedure Benchmark_Keccak_256 is new Hash_Benchmark
      ("Keccak-256", SHA3.Keccak_256);
   procedure Benchmark_Keccak_384 is new Hash_Benchmark
      ("Keccak-384", SHA3.Keccak_384);
   procedure Benchmark_Keccak_512 is new Hash_Benchmark
      ("Keccak-512", SHA3.Keccak_512);

   procedure Benchmark_SHAKE128 is new XOF_Benchmark
      ("SHAKE128", SHAKE.SHAKE128);
   procedure Benchmark_SHAKE256 is new XOF_Benchmark
      ("SHAKE256", SHAKE.SHAKE256);

   procedure Benchmark_RawSHAKE128 is new XOF_Benchmark
      ("RawSHAKE128", RawSHAKE.RawSHAKE128);
   procedure Benchmark_RawSHAKE256 is new XOF_Benchmark
      ("RawSHAKE256", RawSHAKE.RawSHAKE256);

   procedure Benchmark_Duplex_r1152c448 is new Duplex_Benchmark
      ("Duplex r1152c448", 448, Keccak.Keccak_1600.Rounds_24.Duplex);
   procedure Benchmark_Duplex_r1088c512 is new Duplex_Benchmark
      ("Duplex r1088c512", 512, Keccak.Keccak_1600.Rounds_24.Duplex);
   procedure Benchmark_Duplex_r832c768 is new Duplex_Benchmark
      ("Duplex r832c768", 768, Keccak.Keccak_1600.Rounds_24.Duplex);
   procedure Benchmark_Duplex_r576c1024 is new Duplex_Benchmark
     ("Duplex r576c1024", 1024, Keccak.Keccak_1600.Rounds_24.Duplex);

   procedure Benchmark_KeccakF_25 is new KeccakF_Benchmark
     ("Keccak-p[25,12]",
      Keccak.Keccak_25.State,
      Keccak.Keccak_25.KeccakF_25.Init,
      Keccak.Keccak_25.Rounds_12.Permute);
   procedure Benchmark_KeccakF_50 is new KeccakF_Benchmark
     ("Keccak-p[50,14]",
      Keccak.Keccak_50.State,
      Keccak.Keccak_50.KeccakF_50.Init,
      Keccak.Keccak_50.Rounds_14.Permute);
   procedure Benchmark_KeccakF_100 is new KeccakF_Benchmark
     ("Keccak-p[100,16]",
      Keccak.Keccak_100.State,
      Keccak.Keccak_100.KeccakF_100.Init,
      Keccak.Keccak_100.Rounds_16.Permute);
   procedure Benchmark_KeccakF_200 is new KeccakF_Benchmark
     ("Keccak-p[200,18]",
      Keccak.Keccak_200.State,
      Keccak.Keccak_200.KeccakF_200.Init,
      Keccak.Keccak_200.Rounds_18.Permute);
   procedure Benchmark_KeccakF_400 is new KeccakF_Benchmark
     ("Keccak-p[400,20]",
      Keccak.Keccak_400.State,
      Keccak.Keccak_400.KeccakF_400.Init,
      Keccak.Keccak_400.Rounds_20.Permute);
   procedure Benchmark_KeccakF_800 is new KeccakF_Benchmark
     ("Keccak-p[800,22]",
      Keccak.Keccak_800.State,
      Keccak.Keccak_800.KeccakF_800.Init,
      Keccak.Keccak_800.Rounds_22.Permute);
   procedure Benchmark_KeccakF_1600_R24 is new KeccakF_Benchmark
     ("Keccak-p[1600,24]",
      Keccak.Keccak_1600.State,
      Keccak.Keccak_1600.KeccakF_1600.Init,
      Keccak.Keccak_1600.Rounds_24.Permute);
   procedure Benchmark_KeccakF_1600_P2_R24 is new KeccakF_Benchmark
     ("Keccak-p[1600,24]×2",
      Keccak.Parallel_Keccak_1600.Parallel_State_P2,
      Keccak.Parallel_Keccak_1600.Init_P2,
      Keccak.Parallel_Keccak_1600.Rounds_24.Permute_All_P2);
   procedure Benchmark_KeccakF_1600_P4_R24 is new KeccakF_Benchmark
     ("Keccak-p[1600,24]×4",
      Keccak.Parallel_Keccak_1600.Parallel_State_P4,
      Keccak.Parallel_Keccak_1600.Init_P4,
      Keccak.Parallel_Keccak_1600.Rounds_24.Permute_All_P4);
   procedure Benchmark_KeccakF_1600_P8_R24 is new KeccakF_Benchmark
     ("Keccak-p[1600,24]×8",
      Keccak.Parallel_Keccak_1600.Parallel_State_P8,
      Keccak.Parallel_Keccak_1600.Init_P8,
      Keccak.Parallel_Keccak_1600.Rounds_24.Permute_All_P8);
   procedure Benchmark_KeccakF_1600_R12 is new KeccakF_Benchmark
     ("Keccak-p[1600,12]",
      Keccak.Keccak_1600.State,
      Keccak.Keccak_1600.KeccakF_1600.Init,
      Keccak.Keccak_1600.Rounds_12.Permute);
   procedure Benchmark_KeccakF_1600_P2_R12 is new KeccakF_Benchmark
     ("Keccak-p[1600,12]×2",
      Keccak.Parallel_Keccak_1600.Parallel_State_P2,
      Keccak.Parallel_Keccak_1600.Init_P2,
      Keccak.Parallel_Keccak_1600.Rounds_12.Permute_All_P2);
   procedure Benchmark_KeccakF_1600_P4_R12 is new KeccakF_Benchmark
     ("Keccak-p[1600,12]×4",
      Keccak.Parallel_Keccak_1600.Parallel_State_P4,
      Keccak.Parallel_Keccak_1600.Init_P4,
      Keccak.Parallel_Keccak_1600.Rounds_12.Permute_All_P4);
   procedure Benchmark_KeccakF_1600_P8_R12 is new KeccakF_Benchmark
     ("Keccak-p[1600,12]×8",
      Keccak.Parallel_Keccak_1600.Parallel_State_P8,
      Keccak.Parallel_Keccak_1600.Init_P8,
      Keccak.Parallel_Keccak_1600.Rounds_12.Permute_All_P8);

   procedure Benchmark_K12 is new K12_Benchmark
     ("KangarooTwelve",
      KangarooTwelve.K12);

   procedure Benchmark_M14 is new K12_Benchmark
     ("MarsupilamiFourteen",
      MarsupilamiFourteen.M14);

   procedure Benchmark_ParallelHash128 is new ParallelHash_Benchmark
     ("ParallelHash128",
      Parallel_Hash.ParallelHash128);
   procedure Benchmark_ParallelHash256 is new ParallelHash_Benchmark
     ("ParallelHash256",
      Parallel_Hash.ParallelHash256);

   procedure Benchmark_Ketje_Jr is new Ketje_Benchmark
     ("Ketje Jr", Ketje.Jr);
   procedure Benchmark_Ketje_Sr is new Ketje_Benchmark
     ("Ketje Sr", Ketje.Sr);
   procedure Benchmark_Ketje_Minor is new Ketje_Benchmark
     ("Ketje Minor", Ketje.Minor);
   procedure Benchmark_Ketje_Major is new Ketje_Benchmark
     ("Ketje Major", Ketje.Major);

   procedure Benchmark_Gimli is new KeccakF_Benchmark
     ("Gimli",
      Gimli.State,
      Gimli.Init,
      Gimli.Permute);

   procedure Benchmark_Gimli_Hash is new Hash_Benchmark
     ("Gimli Hash",
      Gimli.Hash);

   procedure Benchmark_Ascon12 is new KeccakF_Benchmark
     ("Ascon (12 rounds)",
      Ascon.State,
      Ascon.Init,
      Ascon.Permutations.Permute_12);

   procedure Benchmark_Ascon8 is new KeccakF_Benchmark
     ("Ascon (8 rounds)",
      Ascon.State,
      Ascon.Init,
      Ascon.Permutations.Permute_8);

   procedure Benchmark_Ascon6 is new KeccakF_Benchmark
     ("Ascon (6 rounds)",
      Ascon.State,
      Ascon.Init,
      Ascon.Permutations.Permute_6);

   procedure Benchmark_Ascon_Hash is new Hash_Benchmark
     ("Ascon-Hash",
      Ascon.Hash);

begin
   Data_Chunk_1.all := (others => 16#A7#);
   Data_Chunk_2.all := (others => 16#A7#);

   Put ("Message size: ");
   Ada.Integer_Text_IO.Put (Data_Chunk_1.all'Length, Width => 0);
   Put (" bytes");
   New_Line;
   Put ("Performing ");
   Ada.Integer_Text_IO.Put (Repeat, Width => 0);
   Put (" measurements for each test");
   New_Line;
   New_Line;

   Benchmark_Gimli;
   Benchmark_Gimli_Hash;

   Benchmark_Ascon12;
   Benchmark_Ascon8;
   Benchmark_Ascon6;
   Benchmark_Ascon_Hash;

   Benchmark_K12;
   Benchmark_M14;
   Benchmark_ParallelHash128;
   Benchmark_ParallelHash256;
   Benchmark_SHA_224;
   Benchmark_SHA_256;
   Benchmark_SHA_384;
   Benchmark_SHA_512;
   Benchmark_Keccak_224;
   Benchmark_Keccak_256;
   Benchmark_Keccak_384;
   Benchmark_Keccak_512;
   Benchmark_SHAKE128;
   Benchmark_SHAKE256;
   Benchmark_RawSHAKE128;
   Benchmark_RawSHAKE256;
   Benchmark_Duplex_r1152c448;
   Benchmark_Duplex_r1088c512;
   Benchmark_Duplex_r832c768;
   Benchmark_Duplex_r576c1024;
   Benchmark_KeccakF_1600_R24;
   Benchmark_KeccakF_1600_P2_R24;
   Benchmark_KeccakF_1600_P4_R24;
   Benchmark_KeccakF_1600_P8_R24;
   Benchmark_KeccakF_1600_R12;
   Benchmark_KeccakF_1600_P2_R12;
   Benchmark_KeccakF_1600_P4_R12;
   Benchmark_KeccakF_1600_P8_R12;
   Benchmark_KeccakF_800;
   Benchmark_KeccakF_400;
   Benchmark_KeccakF_200;
   Benchmark_KeccakF_100;
   Benchmark_KeccakF_50;
   Benchmark_KeccakF_25;
   Benchmark_Ketje_Jr;
   Benchmark_Ketje_Sr;
   Benchmark_Ketje_Minor;
   Benchmark_Ketje_Major;

end Benchmark;