File : g-sehamd.ads
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT LIBRARY COMPONENTS --
4 -- --
5 -- G N A T . S E C U R E _ H A S H E S . M D 5 --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2002-2009, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- --
19 -- --
20 -- --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
31
32 -- This package provides supporting code for implementation of the MD5
33 -- Message-Digest Algorithm as described in RFC 1321. The complete text of
34 -- RFC 1321 can be found at:
35 -- http://www.ietf.org/rfc/rfc1321.txt
36
37 -- This is an internal unit and should not be used directly in applications.
38 -- Use GNAT.MD5 instead.
39
40 with GNAT.Byte_Swapping;
41 with Interfaces;
42
43 package GNAT.Secure_Hashes.MD5 is
44
45 package Hash_State is
46 new GNAT.Secure_Hashes.Hash_Function_State
47 (Word => Interfaces.Unsigned_32,
48 Swap => GNAT.Byte_Swapping.Swap4,
49 Hash_Bit_Order => System.Low_Order_First);
50 -- MD5 operates on 32-bit little endian words
51
52 Block_Words : constant := 16;
53 -- Messages are processed in chunks of 16 words
54
55 procedure Transform
56 (H : in out Hash_State.State;
57 M : in out Message_State);
58 -- Transformation function applied for each block
59
60 Initial_State : constant Hash_State.State;
61 -- Initialization vector
62
63 private
64
65 Initial_A : constant := 16#67452301#;
66 Initial_B : constant := 16#EFCDAB89#;
67 Initial_C : constant := 16#98BADCFE#;
68 Initial_D : constant := 16#10325476#;
69
70 Initial_State : constant Hash_State.State :=
71 (Initial_A, Initial_B, Initial_C, Initial_D);
72 -- Initialization vector from RFC 1321
73
74 end GNAT.Secure_Hashes.MD5;