Package: LSC.RIPEMD160

Dependencies

with LSC.Types;
use type LSC.Types.Word32;
use type LSC.Types.Word64;
use type LSC.Types.Index;
 inherit
    LSC.Types,
    LSC.Ops32,
    LSC.Pad32,
    LSC.Debug;

Description

The RIPEMD-160 hash algorithm

Header

package LSC.RIPEMD160 is
 

Known child units

LSC.RIPEMD160.Print(private package)

Type Summary

Context_Type
Primitive Operations:  Context_Finalize, Context_Init, Context_Update, Get_Hash
Message_Type

Constants and Named Numbers

Block_Size : constant := 512;
RIPEMD-160 block size
Null_Block : constant Block_Type;
Empty block
Null_Hash : constant Hash_Type;
Empty hash

Other Items:

type Context_Type is private;
RIPEMD-160 context

subtype Block_Index is Types.Index range 0 .. 15;
Index for RIPEMD-160 block

subtype Block_Type is Types.Word32_Array_Type (Block_Index);
RIPEMD-160 block

subtype Hash_Index is Types.Index range 0 .. 4;
Index for RIPEMD-160 hash

subtype Hash_Type is Types.Word32_Array_Type (Hash_Index);
RIPEMD-160 hash

subtype Block_Length_Type is Types.Word32 range 0 .. Block_Size - 1;
RIPEMD-160 block length

subtype Message_Index is Types.Word64 range 0 .. 2 ** 53 - 1;
Index for RIPEMD-160 message

A RIPEMD160 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;
RIPEMD-160 message

function Context_Init return Context_Type;
Initialize RIPEMD-160 context.

procedure Context_Update
  (Context : in out Context_Type;
   Block   : in     Block_Type);
Update RIPEMD-160 Context with message block Block.
 derives Context from *,
                      Block;

procedure Context_Finalize
  (Context : in out Context_Type;
   Block   : in     Block_Type;
   Length  : in     Block_Length_Type);
Finalize RIPEMD-160 context using Length bits of final message block Block.
 derives Context from *,
                      Block,
                      Length;

function Get_Hash (Context : Context_Type) return Hash_Type;
Return RIPEMD-160 hash from Context.

private

   --  Implementation-defined ...
end LSC.RIPEMD160;