Home Reference Source Test
public interface | source

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

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 ready blocks

Public Constructors

public constructor(options: Object) source

Params:

NameTypeAttributeDescription
options Object

Public Members

public blockSize: number source

Size of block in units

public blockSizeInBytes: number source

Size of block in bytes

public options: * source

public unitOrder: number source

Bytes order in unit 0 - normal 1 - reverse

public unitSize: number source

Size of unit in bytes (4 = 32 bits)

Protected Members

protected state: Object source

All algorithm variables that changed during process

Properties:

NameTypeAttributeDescription
state.message string

Unprocessed Message

state.length number

Length of message

Public Methods

public finalize(): string source

Finalize hash and return result

Return:

string

public getState(): Object source

Return current state

Return:

Object

public reset() source

Reset hasher to initial state

public setState(state: Object) source

Set current state

Params:

NameTypeAttributeDescription
state Object

public update(message: string) source

Update message from binary string

Params:

NameTypeAttributeDescription
message string

Protected Methods

protected addPaddingISO7816(length: number) source

Add ISO7816-4 padding to message Pad with 0x80 followed by zero bytes

Params:

NameTypeAttributeDescription
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:

NameTypeAttributeDescription
length number

protected addPaddingZero(length: number) source

Add zero padding to message Pad with 0x00 characters

Params:

NameTypeAttributeDescription
length number

protected getStateHash(size: number): string source

Get hash from state

Params:

NameTypeAttributeDescription
size number
  • optional
  • default: this.state.hash.length

Limit hash size (in chunks)

Return:

string

protected process() source

Process ready blocks