---
title: "Class: CryptoUtils"
canonical_url: "https://nimiq.dev/web-client/reference/classes/cryptoutils"
---
# Class: CryptoUtils

[@nimiq/core](../globals) / CryptoUtils

Defined in: @nimiq/core/types/wasm/web.d.ts:1242

## Methods

### [dispose]()

> **[dispose]**(): `void`

Defined in: @nimiq/core/types/wasm/web.d.ts:1245

#### Returns

`void`

---

### free()

> **free**(): `void`

Defined in: @nimiq/core/types/wasm/web.d.ts:1244

#### Returns

`void`

---

### computeHmacSha512()

> `static` **computeHmacSha512**(`key`, `data`): `Uint8Array`

Defined in: @nimiq/core/types/wasm/web.d.ts:1251

Computes a 64-byte <span>

HMAC

</span>

-SHA512 hash from the input key and data.

#### Parameters

##### key

`Uint8Array`

##### data

`Uint8Array`

#### Returns

`Uint8Array`

---

### computePBKDF2sha512()

> `static` **computePBKDF2sha512**(`password`, `salt`, `iterations`, `derived_key_length`): `Uint8Array`

Defined in: @nimiq/core/types/wasm/web.d.ts:1257

Computes a <span>

PBKDF2

</span>

-over-SHA512 key from the password with the given parameters.

#### Parameters

##### password

`Uint8Array`

##### salt

`Uint8Array`

##### iterations

`number`

##### derived_key_length

`number`

#### Returns

`Uint8Array`

---

### getRandomValues()

> `static` **getRandomValues**(`length`): `Uint8Array`

Defined in: @nimiq/core/types/wasm/web.d.ts:1261

Generates a secure random byte array of the given length.

#### Parameters

##### length

`number`

#### Returns

`Uint8Array`

---

### otpKdf()

> `static` **otpKdf**(`message`, `key`, `salt`, `iterations`): `Promise`<`Uint8Array`<`ArrayBufferLike`>>

Defined in: @nimiq/core/types/wasm/web.d.ts:1269

Encrypts a message with an <span>

OTP

</span>

 <span>

KDF

</span>

 and the given parameters.
The KDF uses Argon2d for hashing.

#### Parameters

##### message

`Uint8Array`

##### key

`Uint8Array`

##### salt

`Uint8Array`

##### iterations

`number`

#### Returns

`Promise`<`Uint8Array`<`ArrayBufferLike`>>


## Sitemap

See the full [sitemap](https://nimiq.dev/sitemap.md) for all pages.
