@technobuddha > library > Binary > Hash
Abstract Class: ShaBase
Defined in: sha-base.ts:14
The base class for sha based cryptographic hash functions
Extends
Extended by
Constructors
Constructor
new ShaBase(blockSize: number, finalSize: number): ShaBase;Defined in: src/sha-base.ts:45
Creates a new instance of the hash base class.
Parameters
| Parameter | Type | Description |
|---|---|---|
blockSize | number | The size of the internal block buffer in bytes. |
finalSize | number | The size of the final hash output in bytes. |
Returns
ShaBase
Overrides
Methods
digest()
Call Signature
digest(): Uint8Array;Defined in: src/sha-base.ts:77
Finalizes the hash computation and returns the resulting hash digest. This method performs any necessary padding and processes the final block of data according to the hash algorithm's specification.
Returns
The hash digest
Overrides
Call Signature
digest(encoding: BinaryEncoding): string;Defined in: src/sha-base.ts:78
Finalizes the hash computation and returns the resulting hash digest. This method performs any necessary padding and processes the final block of data according to the hash algorithm's specification.
Parameters
| Parameter | Type | Description |
|---|---|---|
encoding | BinaryEncoding | Optional. The encoding to use for the output digest (e.g., 'hex', 'base64'). |
Returns
string
An encoded string, depending on the encoding parameter.
Overrides
update()
Call Signature
update(data: BinaryObject | ArrayLike<number>): this;Defined in: src/sha-base.ts:119
Updates the hash with the given binary data.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | BinaryObject | ArrayLike<number> | The data to update the hash with, as a BinaryObject. |
Returns
this
The hash instance for method chaining.
Overrides
Call Signature
update(data: string, encoding?: TextEncoding): this;Defined in: src/sha-base.ts:120
Updates the hash with the given string data.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | string | The string data to update the hash with. |
encoding? | TextEncoding | Optional text encoding of the input string (e.g., 'utf8'). |
Returns
this
The hash instance for method chaining.