Class TRALHashBase

Unit

Declaration

type TRALHashBase = class(TObject)

Description

TRALHashBase

Hierarchy

Overview

Methods

Public constructor Create(AOutputType: TRALHashOutputType = rhotHex);
Public function HashAsStream(AValue: TStream): TStream;
Public function HashAsString(const AValue: StringRAL): StringRAL; overload; virtual;
Public function HashAsString(AValue: TStream): StringRAL; overload; virtual;
Public function HMACAsString(AValue: TBytes; const AKey: StringRAL): StringRAL; overload; virtual;
Public function HMACAsString(const AValue: StringRAL; const AKey: StringRAL): StringRAL; overload; virtual;
Public function HMACAsString(AValue: TStream; const AKey: StringRAL): StringRAL; overload; virtual;
Protected function DigestToBase64(AValue: TBytes): StringRAL;
Protected function DigestToBase64Url(AValue: TBytes): StringRAL;
Protected function DigestToHex(AValue: TBytes): StringRAL;
Protected function Finalize: TBytes; virtual;
Protected function GetBuffer(AIndex: IntegerRAL): Pointer; virtual; abstract;
Protected function GetBufLength: IntegerRAL; virtual; abstract;
Protected function GetDigest(AValue: TBytes): TBytes; overload; virtual;
Protected function GetDigest(const AValue: StringRAL): TBytes; overload; virtual;
Protected function GetDigest(AValue: TStream): TBytes; overload; virtual;
Protected function GetIndex: IntegerRAL;
Protected function GetLenBit: UInt64RAL;
Protected function HMACAsDigest(AValue: TStream; AKey: TBytes): TBytes; virtual;
Protected procedure Compress; virtual;
Protected procedure HashBytes(AData: pbyte; ALength: IntegerRAL); virtual;
Protected procedure Initialize; virtual;
Protected procedure UpdateBuffer(AValue: TStream); overload; virtual;
Protected procedure UpdateBuffer(AValue: TBytes); overload; virtual;
Protected procedure UpdateBuffer(const AValue: StringRAL); overload; virtual;

Properties

Published property OutputType: TRALHashOutputType read FOutputType write FOutputType;

Description

Methods

Public constructor Create(AOutputType: TRALHashOutputType = rhotHex);
 
Public function HashAsStream(AValue: TStream): TStream;

Returns a stream hash from a stream

Public function HashAsString(const AValue: StringRAL): StringRAL; overload; virtual;

Returns a string hash from a string

Public function HashAsString(AValue: TStream): StringRAL; overload; virtual;

Returns a string hash from a stream

Public function HMACAsString(AValue: TBytes; const AKey: StringRAL): StringRAL; overload; virtual;

Returns a string of a HMAC generated given an Array of bytes

Public function HMACAsString(const AValue: StringRAL; const AKey: StringRAL): StringRAL; overload; virtual;

Returns a string of a HMAC generated given an UTF8String

Public function HMACAsString(AValue: TStream; const AKey: StringRAL): StringRAL; overload; virtual;

Returns a string of a HMAC generated given a Stream

Protected function DigestToBase64(AValue: TBytes): StringRAL;

Convert hash (return Finalize) to base64

Protected function DigestToBase64Url(AValue: TBytes): StringRAL;

Convert hash (return Finalize) to base64-url

Protected function DigestToHex(AValue: TBytes): StringRAL;

Convert hash (return Finalize) to hexadecimal

Protected function Finalize: TBytes; virtual;

Finalize the hash and returns it

Protected function GetBuffer(AIndex: IntegerRAL): Pointer; virtual; abstract;

Returns the buffer pointer at a given position

Protected function GetBufLength: IntegerRAL; virtual; abstract;

Returns the length of the buffer

Protected function GetDigest(AValue: TBytes): TBytes; overload; virtual;

Generates a hash of a given piece of Array of Bytes content

Protected function GetDigest(const AValue: StringRAL): TBytes; overload; virtual;

Generates a hash of a given piece of UTF8String content

Protected function GetDigest(AValue: TStream): TBytes; overload; virtual;

Generates a hash of a given piece of Stream content

Protected function GetIndex: IntegerRAL;

Returns the position of the buffer

Protected function GetLenBit: UInt64RAL;

Returns the total buffer in bits

Protected function HMACAsDigest(AValue: TStream; AKey: TBytes): TBytes; virtual;

Generates an HMAC hash of a given content

Protected procedure Compress; virtual;

Used to compress the content, generating the hash

Protected procedure HashBytes(AData: pbyte; ALength: IntegerRAL); virtual;

Picks up incoming and compact content according to buffer length

Protected procedure Initialize; virtual;

Used to initialize the hash

Protected procedure UpdateBuffer(AValue: TStream); overload; virtual;

Used to insert more content that will generate the hash

Protected procedure UpdateBuffer(AValue: TBytes); overload; virtual;

Used to insert more content that will generate the hash

Protected procedure UpdateBuffer(const AValue: StringRAL); overload; virtual;

Used to insert more content that will generate the hash

Properties

Published property OutputType: TRALHashOutputType read FOutputType write FOutputType;

Identifies the formatting of the hash



GitHub Repository
Generated by PasDoc 0.16.0.