Hasher
Base hasher class
Constructor Summary
Public Constructor | ||
public |
constructor(options: Object) |
Member Summary
Public Members | ||
public |
blockSize: number Size of block in units |
|
public |
blockSizeInBytes: number Size of block in bytes |
|
public |
options: * |
|
public |
unitOrder: number Bytes order in unit 0 - normal 1 - reverse |
|
public |
unitSize: number Size of unit in bytes (4 = 32 bits) |
Protected Members | ||
protected |
state: Object All algorithm variables that changed during process |
Method Summary
Public Methods | ||
public |
finalize(): string Finalize hash and return result |
|
public |
getState(): Object Return current state |
|
public |
reset() Reset hasher to initial state |
|
public |
setState(state: Object) Set current state |
|
public |
update(message: string) Update message from binary string |
Protected Methods | ||
protected |
addPaddingISO7816(length: number) Add ISO7816-4 padding to message Pad with 0x80 followed by zero bytes |
|
protected |
addPaddingPKCS7(length: number) Add PKCS7 padding to message Pad with bytes all of the same value as the number of padding bytes |
|
protected |
addPaddingZero(length: number) Add zero padding to message Pad with 0x00 characters |
|
protected |
getStateHash(size: number): string Get hash from state |
|
protected |
process() Process ready blocks |
Public Constructors
public constructor(options: Object) source
Params:
Name | Type | Attribute | Description |
options | Object |
Public Members
public options: * source
Protected Members
protected state: Object source
All algorithm variables that changed during process
Properties:
Name | Type | Attribute | Description |
state.message | string | Unprocessed Message |
|
state.length | number | Length of message |
Public Methods
public setState(state: Object) source
Set current state
Params:
Name | Type | Attribute | Description |
state | Object |
public update(message: string) source
Update message from binary string
Params:
Name | Type | Attribute | Description |
message | string |
Protected Methods
protected addPaddingISO7816(length: number) source
Add ISO7816-4 padding to message Pad with 0x80 followed by zero bytes
Params:
Name | Type | Attribute | Description |
length | number |
protected addPaddingPKCS7(length: number) source
Add PKCS7 padding to message Pad with bytes all of the same value as the number of padding bytes
Params:
Name | Type | Attribute | Description |
length | number |
protected addPaddingZero(length: number) source
Add zero padding to message Pad with 0x00 characters
Params:
Name | Type | Attribute | Description |
length | number |
protected getStateHash(size: number): string source
Get hash from state
Params:
Name | Type | Attribute | Description |
size | number |
|
Limit hash size (in chunks) |
Return:
string |