# Generating Device Fingerprint

The Zentitle2Core Library offers the option to generate a device fingerprint based on a variety of hardware identifiers. To assist with this process, this page provides detailed instructions on how to use the library functions and outlines the available options for generating device fingerprints.

{% hint style="info" %}
**Please note that t**he generated fingerprint can be up to 99 characters long. The output buffer must be preallocated with at least 100 bytes.
{% endhint %}

### Constants for Fingerprint Options

The library provides predefined values that can be used to specify various options for generating fingerprints. These values are known as constants. We offer two options for generating a device fingerprint.

* `FINGERPRINT_OPTION_DEFAULT` (Value: 1) - This option generates the device fingerprint using default settings.
* `FINGERPRINT_OPTION_MAC_ADDRESS` (Value: 2) - This option generates the device fingerprint using default settings and includes the MAC address.

### Function: `generateDeviceFingerprint`

This function generates a device fingerprint using a combination of hardware identifiers. You can specify additional hardware identifiers to be included in the fingerprint generation process using a parameter.

#### Parameters

* `fingerprint` (Output): A character array where the generated device fingerprint will be stored.
* `length` (output): receives the length of the generated fingerprint
* `options` (Input, Optional): Specifies the additional hardware identifiers to be used in generating the fingerprint. It can be one of the following values:
  * `FINGERPRINT_OPTION_DEFAULT`: Use the default fingerprinting method.
  * `FINGERPRINT_OPTION_MAC_ADDRESS`: Use defaults and MAC address.

#### Return Value

* `N_OK` if the fingerprint was generated successfully
* `N_ERR_*` if the operation failed

### Function: `generateDefaultDeviceFingerprint`

This function generates a device fingerprint using default settings.

#### Parameters

* `fingerprint` (Output): A character array where the generated device fingerprint will be stored. The maximum length of the device fingerprint is 100 characters.
* `length` (output): receives the length of the generated fingerprint

#### Return Value

* `N_OK` if the fingerprint was generated successfully
* `N_ERR_*` if the operation failed

{% hint style="info" %}
It is possible to provide a custom library that modifies the default behavior to use the MAC address by default, making it easier for users to generate device fingerprints without specifying the option in their code.
{% endhint %}

This customization option can streamline the process of generating device fingerprints with the desired configuration.

Additionally, the library can be generated under a different name specified by the client to keep its purpose hidden.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nalpeiron.com/zentitle2-docs/developers/the-zentitle2core-library-c++/generating-device-fingerprint.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
