-- HMAC - Provide a comprehensive generic HMAC package that suffices for the SHA family and whatnot. -- Copyright (C) 2023 Prince Trippy . -- This program is free software: you can redistribute it and/or modify it under the terms of the -- GNU Affero General Public License version 3 as published by the Free Software Foundation. -- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without -- even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- See the GNU Affero General Public License for more details. -- You should have received a copy of the GNU Affero General Public License along with this program. -- If not, see . generic -- I'm not entirely pleased with these names, or the tighter index specifications. Oh well. type Unit_Type is mod <>; type Index_Type is range <>; type Length_Type is mod <>; subtype Block_Range is Index_Type range <>; type Unit_Array is array (Index_Type range <>) of Unit_Type; type Unit_Block is array (Block_Range) of Unit_Type; type Status_Type is private; type Digest_Type is private; Initial_Status_Constant : in Status_Type; Inner_Pad, Outer_Pad : in Unit_Block; with function To_Unit (Datum : in Digest_Type) return Unit_Array; with function Hash (Data : in Unit_Array) return Digest_Type is <>; with function Hash (State : in Status_Type; Data : in Unit_Block) return Status_Type is <>; with function Hash (State : in Status_Type; Data : in Unit_Array; Unit_Length : in Natural) return Digest_Type is <>; package HMAC is type Prepared_Key is private; -- The name Keypair for this type was considered, but was too poor. function Prepare_Key (Key : in Unit_Array) return Prepared_Key; function HMAC (Key : in Prepared_Key; Data : in Unit_Array) return Digest_Type; private type Prepared_Key is record Outer_Status, Inner_Status : Status_Type; end record; end HMAC; .