1 ------------------------------------------------------------------------------
3 -- GNAT LIBRARY COMPONENTS --
5 -- G N A T . S E C U R E _ H A S H E S . S H A 1 --
9 -- Copyright (C) 2002-2009, Free Software Foundation, Inc. --
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. --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
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/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 -- This package provides supporting code for implementation of the SHA-1
33 -- secure hash function as described in FIPS PUB 180-3. The complete text
34 -- of FIPS PUB 180-3 can be found at:
35 -- http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf
37 -- This is an internal unit and should not be used directly in applications.
38 -- Use GNAT.SHA1 instead.
40 with GNAT
.Byte_Swapping
;
43 package GNAT
.Secure_Hashes
.SHA1
is
45 package Hash_State
is new Hash_Function_State
46 (Word
=> Interfaces
.Unsigned_32
,
47 Swap
=> GNAT
.Byte_Swapping
.Swap4
,
48 Hash_Bit_Order
=> System
.High_Order_First
);
49 -- SHA-1 operates on 32-bit big endian words
51 Block_Words
: constant := 16;
52 -- Messages are processed in chunks of 16 words
55 (H
: in out Hash_State
.State
;
56 M
: in out Message_State
);
57 -- Transformation function applied for each block
59 Initial_State
: constant Hash_State
.State
;
60 -- Initialization vector
64 Initial_State
: constant Hash_State
.State
:=
70 -- Initialization vector from FIPS PUB 180-3
72 end GNAT
.Secure_Hashes
.SHA1
;