with LSC.Types; use type LSC.Types.Index; use type LSC.Types.Word32; use type LSC.Types.Word64;
package LSC.SHA256 is
LSC.SHA256.Tables
Context_Type
Context_Finalize
Context_Update
SHA256_Context_Init
SHA256_Get_Hash
Message_Type
Block_Size : constant := 512;
Null_Block : constant Block_Type;
SHA256_Null_Hash : constant SHA256_Hash_Type;
type Context_Type is private;
subtype Block_Index is Types.Index range 0 .. 15;
subtype Block_Type is Types.Word32_Array_Type (Block_Index);
subtype SHA256_Hash_Index is Types.Index range 0 .. 7;
subtype SHA256_Hash_Type is Types.Word32_Array_Type (SHA256_Hash_Index);
subtype Block_Length_Type is Types.Word32 range 0 .. Block_Size - 1;
subtype Message_Index is Types.Word64 range 0 .. 2 ** 53 - 1;
A SHA-256 message can be at most 2^64 bit long. As one block has 511 bit, this makes 2^53 blocks.
type Message_Type is array (Message_Index range <>) of Block_Type;
function SHA256_Context_Init return Context_Type;
procedure Context_Update (Context : in out Context_Type; Block : in Block_Type); pragma Inline (Context_Update);
Context
Block
derives Context from *, Block;
procedure Context_Finalize (Context : in out Context_Type; Block : in Block_Type; Length : in Block_Length_Type);
Length
derives Context from *, Block, Length;
function SHA256_Get_Hash (Context : Context_Type) return SHA256_Hash_Type;
private -- Implementation-defined ...
end LSC.SHA256;