Skip to main content

Class: Curl

Class to implement Curl sponge.

Table of contents

Properties

Constructors

Methods

Properties

HASH_LENGTH

Static Readonly HASH_LENGTH: number = 243

The Hash Length.


STATE_LENGTH

Static Readonly STATE_LENGTH: number

The State Length.

Constructors

constructor

new Curl(rounds?)

Create a new instance of Curl.

Parameters

NameTypeDefault valueDescription
roundsnumberCurl.NUMBER_OF_ROUNDSThe number of rounds to perform.

Methods

transform

Static transform(curlState, rounds): void

Sponge transform function.

Parameters

NameTypeDescription
curlStateInt8ArrayThe curl state to transform.
roundsnumberThe number of rounds to use.

Returns

void


reset

reset(): void

Resets the state.

Returns

void


rate

rate(len?): Int8Array

Get the state of the sponge.

Parameters

NameTypeDefault valueDescription
lennumberCurl.HASH_LENGTHThe length of the state to get.

Returns

Int8Array

The state.


absorb

absorb(trits, offset, length): void

Absorbs trits given an offset and length.

Parameters

NameTypeDescription
tritsInt8ArrayThe trits to absorb.
offsetnumberThe offset to start abororbing from the array.
lengthnumberThe length of trits to absorb.

Returns

void


squeeze

squeeze(trits, offset, length): void

Squeezes trits given an offset and length.

Parameters

NameTypeDescription
tritsInt8ArrayThe trits to squeeze.
offsetnumberThe offset to start squeezing from the array.
lengthnumberThe length of trits to squeeze.

Returns

void