* tree-ssa-pre.c (grand_bitmap_obstack): New.
[official-gcc.git] / gcc / ada / g-md5.ads
blob2ebd027dd652bc46d43dd6d7bf0258f24771258c
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT LIBRARY COMPONENTS --
4 -- --
5 -- G N A T . M D 5 --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2002-2004 Ada Core Technologies, 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 2, 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. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
21 -- --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
28 -- --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 -- --
32 ------------------------------------------------------------------------------
34 -- This package implements the MD5 Message-Digest Algorithm as described in
35 -- RFC 1321. The complete text of RFC 1321 can be found at:
37 -- http://www.ietf.org/rfc/rfc1321.txt
39 -- The implementation is derived from the RSA Data Secutity, Inc. MD5
40 -- Message-Digest Algorithm, as described in RFC 1321.
42 with Ada.Streams;
43 with Interfaces;
45 package GNAT.MD5 is
47 type Context is private;
48 -- This type is the four-word (16 byte) MD buffer, as described in
49 -- RFC 1321 (3.3). It initial value is Initial_Context below.
51 Initial_Context : constant Context;
52 -- Initial value of a Context object. May be used to reinitialize
53 -- a Context value by simple assignment of this value to the object.
55 procedure Update
56 (C : in out Context;
57 Input : String);
58 procedure Wide_Update
59 (C : in out Context;
60 Input : Wide_String);
61 procedure Update
62 (C : in out Context;
63 Input : Ada.Streams.Stream_Element_Array);
64 -- Modify the Context C. If C has the initial value Initial_Context,
65 -- then, after a call to one of these procedures, Digest (C) will return
66 -- the Message-Digest of Input.
68 -- These procedures may be called successively with the same context and
69 -- different inputs, and these several successive calls will produce
70 -- the same final context as a call with the concatenation of the inputs.
72 subtype Message_Digest is String (1 .. 32);
73 -- The string type returned by function Digest.
75 function Digest (C : Context) return Message_Digest;
76 -- Extracts the Message-Digest from a context. This function should be
77 -- used after one or several calls to Update.
79 function Digest (S : String) return Message_Digest;
80 function Wide_Digest (W : Wide_String) return Message_Digest;
81 function Digest
82 (A : Ada.Streams.Stream_Element_Array)
83 return Message_Digest;
84 -- These functions are equivalent to the corresponding Update (or
85 -- Wide_Update) on a default initialized Context, followed by Digest
86 -- on the resulting Context.
88 private
90 -- Magic numbers
91 Initial_A : constant := 16#67452301#;
92 Initial_B : constant := 16#EFCDAB89#;
93 Initial_C : constant := 16#98BADCFE#;
94 Initial_D : constant := 16#10325476#;
96 type Context is record
97 A : Interfaces.Unsigned_32 := Initial_A;
98 B : Interfaces.Unsigned_32 := Initial_B;
99 C : Interfaces.Unsigned_32 := Initial_C;
100 D : Interfaces.Unsigned_32 := Initial_D;
101 Buffer : String (1 .. 64) := (others => ASCII.NUL);
102 Last : Natural := 0;
103 Length : Natural := 0;
104 end record;
106 Initial_Context : constant Context :=
107 (A => Initial_A, B => Initial_B, C => Initial_C, D => Initial_D,
108 Buffer => (others => ASCII.NUL), Last => 0, Length => 0);
110 end GNAT.MD5;