Skip to main content

SHA2 module

📖 Description

The SHA2 module contains SHA2 cryptographic hash functions.

Rationale

The functions in this module are primitive and probably widely available in many other open-source packages on npm. So why are they included in the Tripetto Builder package? That's because the Tripetto Builder doesn't have any dependency on other npm packages. So all the code needed to build a Tripetto form is included and these functions are simply required. Since they are part of the package, they are exported so you can use them too. For example when building custom blocks.

▶️ Functions


🔧 CSHA2_224

Cached version of SHA2_224. Each generated hash is stored in a volatile cache. When the same data is hashed a second time, the cached version is used instead of another hash calculation.

Signature

CSHA2_224(data: string): string

Parameters

NameTypeOptionalDescription
datastringNoSpecifies the data to hash.

Return value

Returns the hash string.


🔧 CSHA2_256

Cached version of SHA2_256. Each generated hash is stored in a volatile cache. When the same data is hashed a second time, the cached version is used instead of another hash calculation.

Signature

CSHA2_256(data: string): string

Parameters

NameTypeOptionalDescription
datastringNoSpecifies the data to hash.

Return value

Returns the hash string.


🔧 CSHA2_384

Cached version of SHA2_384. Each generated hash is stored in a volatile cache. When the same data is hashed a second time, the cached version is used instead of another hash calculation.

Signature

CSHA2_384(data: string): string

Parameters

NameTypeOptionalDescription
datastringNoSpecifies the data to hash.

Return value

Returns the hash string.


🔧 CSHA2_512

Cached version of SHA2_512. Each generated hash is stored in a volatile cache. When the same data is hashed a second time, the cached version is used instead of another hash calculation.

Signature

CSHA2_512(data: string): string

Parameters

NameTypeOptionalDescription
datastringNoSpecifies the data to hash.

Return value

Returns the hash string.


🔧 CSHA2_512_224

Cached version of SHA2_512_224. Each generated hash is stored in a volatile cache. When the same data is hashed a second time, the cached version is used instead of another hash calculation.

Signature

CSHA2_512_224(data: string): string

Parameters

NameTypeOptionalDescription
datastringNoSpecifies the data to hash.

Return value

Returns the hash string.


🔧 CSHA2_512_256

Cached version of SHA2_512_256. Each generated hash is stored in a volatile cache. When the same data is hashed a second time, the cached version is used instead of another hash calculation.

Signature

CSHA2_512_256(data: string): string

Parameters

NameTypeOptionalDescription
datastringNoSpecifies the data to hash.

Return value

Returns the hash string.


🔧 SHA2_224

Hashes the supplied string data using SHA2-224.

Signature

SHA2_224(data: string): string

Parameters

NameTypeOptionalDescription
datastringNoSpecifies the data to hash.

Return value

Returns the hash string.


🔧 SHA2_256

Hashes the supplied string data using SHA2-256.

Signature

SHA2_256(data: string): string

Parameters

NameTypeOptionalDescription
datastringNoSpecifies the data to hash.

Return value

Returns the hash string.


🔧 SHA2_384

Hashes the supplied string data using SHA2-384.

Signature

SHA2_384(data: string): string

Parameters

NameTypeOptionalDescription
datastringNoSpecifies the data to hash.

Return value

Returns the hash string.


🔧 SHA2_512

Hashes the supplied string data using SHA2-512.

Signature

SHA2_512(data: string): string

Parameters

NameTypeOptionalDescription
datastringNoSpecifies the data to hash.

Return value

Returns the hash string.


🔧 SHA2_512_224

Hashes the supplied string data using SHA2-512/224.

Signature

SHA2_512_224(data: string): string

Parameters

NameTypeOptionalDescription
datastringNoSpecifies the data to hash.

Return value

Returns the hash string.


🔧 SHA2_512_256

Hashes the supplied string data using SHA2-512/256.

Signature

SHA2_512_256(data: string): string

Parameters

NameTypeOptionalDescription
datastringNoSpecifies the data to hash.

Return value

Returns the hash string.