-- --
-- S p e c --
-- --
--- --
--- Copyright (C) 2002 Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2006, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
--- MA 02111-1307, USA. --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
--- GNAT is maintained by Ada Core Technologies Inc (http://www.gnat.com). --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
---
+
-- This package implements the MD5 Message-Digest Algorithm as described in
-- RFC 1321. The complete text of RFC 1321 can be found at:
--
type Context is private;
-- This type is the four-word (16 byte) MD buffer, as described in
- -- RFC 1321 (3.3). It initial value is Initial_Context below.
+ -- RFC 1321 (3.3). Its initial value is Initial_Context below.
Initial_Context : constant Context;
-- Initial value of a Context object. May be used to reinitialize
-- the Message-Digest of Input.
--
-- These procedures may be called successively with the same context and
- -- different inputs. However, several successive calls will not produce
+ -- different inputs, and these several successive calls will produce
-- the same final context as a call with the concatenation of the inputs.
subtype Message_Digest is String (1 .. 32);
- -- The string type returned by function Digest.
+ -- The string type returned by function Digest
function Digest (C : Context) return Message_Digest;
-- Extracts the Message-Digest from a context. This function should be
private
-- Magic numbers
+
Initial_A : constant := 16#67452301#;
Initial_B : constant := 16#EFCDAB89#;
Initial_C : constant := 16#98BADCFE#;
B : Interfaces.Unsigned_32 := Initial_B;
C : Interfaces.Unsigned_32 := Initial_C;
D : Interfaces.Unsigned_32 := Initial_D;
+ Buffer : String (1 .. 64) := (others => ASCII.NUL);
+ Last : Natural := 0;
+ Length : Natural := 0;
end record;
Initial_Context : constant Context :=
- (A => Initial_A, B => Initial_B, C => Initial_C, D => Initial_D);
+ (A => Initial_A, B => Initial_B, C => Initial_C, D => Initial_D,
+ Buffer => (others => ASCII.NUL), Last => 0, Length => 0);
end GNAT.MD5;