|
Main St, Anywhere, USA 00000 1-111-222-3333 |
|
Erlang Encryption Internet Programming News Shopping Travel Planning United States USS Wasp Netherlands Home |
with Ada.Text_IO;
with GNAT.SHA256;
procedure Test_HMAC is
-- Define your text data and secret key
Data : constant String := "The quick brown fox jumps over the lazy dog";
Key : constant String := "secret_key_123";
-- Buffer to store the resulting binary HMAC digest
Result : GNAT.SHA256.Binary_Message_Digest;
begin
-- 1. Compute the HMAC signature in binary form
Result := GNAT.SHA256.HMAC (Value => Data, Key => Key);
-- 2. Convert the binary signature into a readable hex string and display it
Ada.Text_IO.Put_Line ("Data: " & Data);
Ada.Text_IO.Put_Line ("HMAC-SHA256 (Hex): " & GNAT.SHA256.To_Hex (Result));
end Test_HMAC;
|