---
title: "Cryptographic functions"
canonical: "https://docs.cuesystem.com/space/CVCHELP/555909182/Cryptographic%20functions"
format: markdown
---
> Macro (toc)

---

# CalculateMD5

This function calculates a 16 bytes MD5 value. A parameter destinationbytestring must be 16 bytes long at least. Read <u>[more about MD5](http://en.wikipedia.org/wiki/MD5)</u>. 

#### Syntax 

```visualbasic
Function CalculateMD5( 
  sourcebytestring As ByteString, 
  ByRef destinationbytestring As ByteString) 
As Boolean
```

#### Parameters* *

sourcebytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the source data. 

destinationbytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the destination data, the MD5 value. It must be 16 bytes long at least. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. 

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[120](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#120)</u>. 

# CalculateSHA1

This function calculates a 20 bytes SHA1 value. A parameter destinationbytestring must be 20 bytes long at least.  

#### Syntax 

```visualbasic
Function CalculateSHA1( 
  sourcebytestring As ByteString, 
  ByRef destinationbytestring As ByteString) 
As Boolean
```

#### Parameters 

sourcebytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the source data. 

destinationbytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the destination data, the SHA1 value. It must be 20 bytes long at least. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. 

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[120](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#120)</u>.  

# CalculateSHA256

This function calculates a 32 bytes SHA2 256bits value. A parameter destinationbytestring must be 32 bytes long at least. 

#### Syntax 

```visualbasic
Function CalculateSHA256( 
  sourcebytestring As ByteString, 
  ByRef destinationbytestring As ByteString) 
As Boolean
```

#### Parameters 

sourcebytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the source data. 

destinationbytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the destination data, the SHA2 256bits value. It must be 32 bytes long at least. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs.

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[120](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#120)</u>. 

# CalculateSHA512

This function calculates a 64 bytes SHA2 512bits value. A parameter destinationbytestring must be 64 bytes long at least.   

#### Syntax 

```visualbasic
Function CalculateSHA512( 
  sourcebytestring As ByteString, 
  ByRef destinationbytestring As ByteString) 
As Boolean
```

#### Parameters 

sourcebytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the source data. 

destinationbytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the destination data, the SHA2 512bits value. It must be 64 bytes long at least. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. 

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[120](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#120)</u>. 


# DecryptAES128CBC

This function decrypts data encrypted by the AES128 algorithm with Cipher Block Chaining (CBC) mode. 

A detailed description of AES is at the link [https://en.wikipedia.org/wiki/Advanced_Encryption_Standard](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)  

A detailed description of CBC is at the link [https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_block_chaining_(CBC)](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_block_chaining_(CBC))  

> ℹ️ This function is supported since firmware 20.30

#### Syntax 

```visualbasic
Function DecryptAES128CBC ( 
  sourcebytestring As ByteString, 
  ByRef destinationbytestring As ByteString, 
  encryptionkey As ByteString, 
  ByRef encryptioniv  As ByteString) 
As Boolean
```

#### Parameters 

sourcebytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the source data. Actual length must be divided by 16 otherwise the function returns False and sets the last error to <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. 

destinationbytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the destination buffer for encrypted data. It must be as long as sourcebytestring at least otherwise the function returns False and sets the last error to 245. 

encyptionkey 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> is the encryption key for encryption. Length must be 16 otherwise the function returns False and sets the last error to value <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. 

encryptioniv 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the initialization vector for encryption. Length must be 16 otherwise the function returns False and sets the last error to value <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. The value of the parameter is changed by function because of Cipher Block Chaining (CBC) algorithm. 

![image-20240118-093701.png](media://8f511d20-1bc6-461f-80b6-739643ec92fd)

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. 

The function GetLastError returns the error number. These errors can happen: <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>, <u>[245](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#245)</u>. 

# DecryptAES256CBC

This function decrypts data encrypted by the AES256 algorithm with Cipher Block Chaining (CBC) mode. 

A detailed description of AES is at the link [https://en.wikipedia.org/wiki/Advanced_Encryption_Standard](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)  

A detailed description of CBC is at the link [https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_block_chaining_(CBC)](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_block_chaining_(CBC))  

#### Syntax 

```visualbasic
Function DecryptAES256CBC ( 
  sourcebytestring As ByteString, 
  ByRef destinationbytestring As ByteString, 
  encryptionkey As ByteString, 
  ByRef encryptioniv  As ByteString) 
As Boolean
```

#### Parameters 

sourcebytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the source data. Actual length must be divided by 16 otherwise the function returns False and sets the last error to <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. 

destinationbytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the destination buffer for encrypted data. It must be as long as sourcebytestring at least otherwise the function returns False and sets the last error to 245. 

encyptionkey 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> is the encryption key for encryption. Length must be 32 otherwise the function returns False and sets the last error to value <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. 

encryptioniv 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the initialization vector for encryption. Length must be 16 otherwise the function returns False and sets the last error to value <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. The value of the parameter is changed by function because of Cipher Block Chaining (CBC) algorithm. 

![image-20240118-093706.png](media://e754cbef-3f56-4016-b3d8-33fa69974851)

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. 

The function GetLastError returns the error number. These errors can happen: <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>, <u>[245](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#245)</u>. 


# DecryptAES128ECB

This function decrypts data encrypted by the AES128 algorithm with Electronic codebook (ECB) mode.

> ℹ️ This function is supported since firmware 20.30

A detailed description of AES is at the link [https://en.wikipedia.org/wiki/Advanced_Encryption_Standard](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)  

A detailed description of ECB is at the lin [https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Electronic_codebook_(ECB)](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Electronic_codebook_(ECB))   

#### Syntax 

```visualbasic
Function DecryptAES128ECB ( 
  sourcebytestring As ByteString, 
  ByRef destinationbytestring As ByteString, 
  encryptionkey As ByteString) 
As Boolean
```

#### Parameters 

sourcebytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the source data. Actual length must be divided by 16 otherwise the function returns False and sets the last error to <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. 

destinationbytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the destination buffer for encrypted data. It must be as long as sourcebytestring at least otherwise the function returns False and sets the last error to 245. 

encyptionkey 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> is the encryption key for encryption. Length must be 16 otherwise the function returns False and sets the last error to value <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. 


![image-20240118-093033.png](media://e43ca80a-85e1-4582-8a3c-04c93776618a)


#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. 

The function GetLastError returns the error number. These errors can happen: <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u> , <u>[245](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#245)</u>. 


# DecryptAES256ECB

This function decrypts data encrypted by the AES256 algorithm with Electronic codebook (ECB) mode.

> ℹ️ This function is supported since firmware 20.30

A detailed description of AES is at the link [https://en.wikipedia.org/wiki/Advanced_Encryption_Standard](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)  

A detailed description of ECB is at the lin [https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Electronic_codebook_(ECB)](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Electronic_codebook_(ECB)) 

#### Syntax 

```visualbasic
Function DecryptAES256ECB ( 
  sourcebytestring As ByteString, 
  ByRef destinationbytestring As ByteString, 
  encryptionkey As ByteString) 
As Boolean
```

#### Parameters 

sourcebytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the source data. Actual length must be divided by 16 otherwise the function returns False and sets the last error to <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. 

destinationbytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the destination buffer for encrypted data. It must be as long as sourcebytestring at least otherwise the function returns False and sets the last error to 245. 

encyptionkey 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> is the encryption key for encryption. Length must be 32 otherwise the function returns False and sets the last error to value <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. 


![image-20240118-093033.png](media://e43ca80a-85e1-4582-8a3c-04c93776618a)


#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. 

The function GetLastError returns the error number. These errors can happen: <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u> , <u>[245](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#245)</u>. 

# EncryptAES128CBC

This function encrypts data by the AES128 algorithm with Cipher Block Chaining (CBC) mode.  

> ℹ️ This function is supported since firmware 20.30

A detailed description of AES is at the link [https://en.wikipedia.org/wiki/Advanced_Encryption_Standard](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)  

A detailed description of CBC detailed the link [https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_block_chaining_(CBC)](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_block_chaining_(CBC))  

#### Syntax 

```visualbasic
Function EncryptAES128CBC ( 
  sourcebytestring As ByteString, 
  ByRef destinationbytestring As ByteString, 
  encryptionkey As ByteString, 
  ByRef encryptioniv  As ByteString) 
As Boolean
```

#### Parameters 

sourcebytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is encrypted data. Actual length must be divided by 16 otherwise the function returns False and sets the last error to <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. 

destinationbytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the destination buffer for unencrypted data. It must be as long as sourcebytestring at least otherwise the function returns False and sets the last error to <u>[245](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#245)</u>. 

encyptionkey 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the encryption key for decryption. Length must be 16 otherwise the function returns False and sets the last error to value <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. 

encryptioniv 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the initialization vector for decryption. Length must be 16 otherwise the function returns False and sets the last error to value <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. The value of the parameter is changed by function because of Cipher Block Chaining (CBC) algorithm. 


![image-20240118-093107.png](media://a400adb8-e26e-4c4b-ae14-086fcaf6efd5)


#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. 

The function GetLastError returns the error number. These errors can happen: <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>, <u>[245](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#245)</u>. 

# EncryptAES256CBC

This function encrypts data by the AES256 algorithm with Cipher Block Chaining (CBC) mode.  

A detailed description of AES is at the link [https://en.wikipedia.org/wiki/Advanced_Encryption_Standard](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)  

A detailed description of CBdetailed the link [https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_block_chaining_(CBC)](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_block_chaining_(CBC))  

#### Syntax 

```visualbasic
Function EncryptAES256CBC ( 
  sourcebytestring As ByteString, 
  ByRef destinationbytestring As ByteString, 
  encryptionkey As ByteString, 
  ByRef encryptioniv  As ByteString) 
As Boolean
```

#### Parameters 

sourcebytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is encrypted data. Actual length must be divided by 16 otherwise the function returns False and sets the last error to <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. 

destinationbytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the destination buffer for unencrypted data. It must be as long as sourcebytestring at least otherwise the function returns False and sets the last error to <u>[245](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#245)</u>. 

encyptionkey 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the encryption key for decryption. Length must be 32 otherwise the function returns False and sets the last error to value <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. 

encryptioniv 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the initialization vector for decryption. Length must be 16 otherwise the function returns False and sets the last error to value <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. The value of the parameter is changed by function because of Cipher Block Chaining (CBC) algorithm. 


![image-20240118-093113.png](media://eff0fb89-c286-4f75-ae77-4daf26caea10)


#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. 

The function GetLastError returns the error number. These errors can happen: <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>, <u>[245](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#245)</u>. 



# EncryptAES128ECB

This function encrypts data by the AES128 algorithm with Electronic codebook (ECB) mode.

> ℹ️ This function is supported since firmware 20.30

A detailed description of AES is at the link [https://en.wikipedia.org/wiki/Advanced_Encryption_Standard](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)  

A detailed description of ECB is at the lin [https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Electronic_codebook_(ECB)](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Electronic_codebook_(ECB)) 

#### Syntax 

```visualbasic
Function EncryptAES128ECB ( 
  sourcebytestring As ByteString, 
  ByRef destinationbytestring As ByteString, 
  encryptionkey As ByteString) 
As Boolean
```

#### Parameters 

sourcebytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is encrypted data. Actual length must be divided by 16 otherwise the function returns False and sets the last error to <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. 

destinationbytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the destination buffer for unencrypted data. It must be as long as sourcebytestring at least otherwise the function returns False and sets the last error to <u>[245](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#245)</u>. 

encyptionkey 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the encryption key for decryption. Length must be 16 otherwise the function returns False and sets the last error to value <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. 


![image-20240118-093858.png](media://613141ff-25ef-4364-be6d-79e829955634)

# EncryptAES256ECB

This function encrypts data by the AES256 algorithm with Electronic codebook (ECB) mode.

> ℹ️ This function is supported since firmware 20.30

A detailed description of AES is at the link [https://en.wikipedia.org/wiki/Advanced_Encryption_Standard](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)  

A detailed description of ECB is at the lin [https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Electronic_codebook_(ECB)](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Electronic_codebook_(ECB)) 

#### Syntax 

```visualbasic
Function EncryptAES256ECB ( 
  sourcebytestring As ByteString, 
  ByRef destinationbytestring As ByteString, 
  encryptionkey As ByteString) 
As Boolean
```

#### Parameters 

sourcebytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is encrypted data. Actual length must be divided by 16 otherwise the function returns False and sets the last error to <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. 

destinationbytestring 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the destination buffer for unencrypted data. It must be as long as sourcebytestring at least otherwise the function returns False and sets the last error to <u>[245](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#245)</u>. 

encyptionkey 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the encryption key for decryption. Length must be 32 otherwise the function returns False and sets the last error to value <u>[244](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#244)</u>. 


![image-20240118-093858.png](media://613141ff-25ef-4364-be6d-79e829955634)


# HMAC_SHA256

The function generates a keyed hash value using the HMAC method [https://en.wikipedia.org/wiki/HMAC](https://en.wikipedia.org/wiki/HMAC) . 

#### Syntax 

```visualbasic
Function HMAC_SHA256 ( 
  key As ByteString, 
  data As ByteString, 
  ByRef result As ByteString) 
As Boolean
```

#### Parameters 

key 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> Shared secret key used for generating the HMAC variant of the message digest 

data 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u>. Data to be hashed. 

result 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the hashed value from input parameters. The declared length of this ByteString must be 32 bytes at least.   

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. The function GetLastError returns the error number. 

# PBKDF2_HMAC_SHA256

The function provides PKCS#5 password-based key derivation function 2. It uses HMAC as a pseudorandom function. PBKDF2 is a key derivation function with a sliding computational cost, used to reduce vulnerabilities to brute force attacks [https://en.wikipedia.org/wiki/PBKDF2](https://en.wikipedia.org/wiki/PBKDF2) .   

#### Syntax 

```visualbasic
Function PBKDF2_HMAC_SHA256( 
  password As ByteString, 
  salt As ByteString, 
  iterations As Long, 
  ByRef derivedkey As ByteString, 
  Optional dklen As Long := 256) 
As Boolean
```

#### Parameters 

password 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the password. 

salt 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is input random data. Salt should contain 16 bytes or more random bytes. 

iterations 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u>. The number of iterations. 

derivedkey 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the destination data. The declared length of this Bytestring must be the same or bigger than the number of required bits defined by dkLen parameter. Example: for dkLen 256 (bits) must be declared length of derivedkey 32 bytes at least.   

dklen 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u>. Is the length of the required derived key in bits. For the SHA256 hash algorithm is it 256 (bits) by default. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs.

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command.