Hash

Discover more about the Hash connector and how to use it on the Digibee Integration Platform.

The Hash connector allows you to generate hashed values from different types of input. Depending on your use case, you can choose to hash specific fields, files, or the entire payload.

Each option exposes its own set of parameters, but all configurations follow the same basic logic: you select the operation, define the hashing algorithm, and adjust additional parameters according to your needs.

Parameters

The configuration parameters are organized into tabs: General and Documentation.

  • The General tab contains all fields used to configure the connector. It includes parameters that are always visible, as well as those that appear dynamically depending on the selected Crypto Operation (for example, Hash Fields, Hash File, or Hash Payload) or Crypto Algorithm (for example, HmacSHA256 or BCrypt).

  • The Documentation tab provides an optional field where you can describe the connector configuration and add business rules or relevant notes.

Fields that support Double Braces expressions are marked in the Supports DB column.

Common parameters

These parameters are always displayed, regardless of the selected operation.

Parameter
Description
Data type
Supports DB
Default value

Alias

Name (alias) for this connector’s output, allowing you to reference it later in the flow using Double Braces expressions. Learn more.

String

hash-1

Crypto Operation

Type of operation to be performed. Possible values: Hash Fields, Hash Payload, or Hash File.

Select

Hash Fields

Crypto Algorithm

Type of algorithm used to generate the hash. Possible values: MD5, SHA-1, SHA-256, SHA-384, SHA-512, HmacSHA1, HmacSHA256, HmacSHA384, HmacSHA512, and BCrypt.

Select

SHA-512

Result As Hexadecimal

If enabled, keeps the hash in hexadecimal format; otherwise, the format will be base64.

Boolean

true

Fail On Error

If enabled, interrupts the pipeline execution when an error occurs. If disabled, execution continues, but the "success" property will be set to false.

Boolean

false

Hash Fields

These parameters are displayed only when the Crypto Operation is set to Hash Fields.

Parameter
Description
Data type
Supports DB
Default value

JSON Field Path

JSON path of the string field in dotted notation.

String

xml.text

Preserve Original

If enabled, preserves the original field as a "Field" property at the same level as the original one.

Boolean

true

Hash File

These parameters are displayed only when the Crypto Operation is set to Hash File.

Parameter
Description
Data type
Supports DB
Default value

File Name

Name of the file or full file path (for example, tmp/processed/file.txt).

String

N/A

Hash Payload

These parameters are displayed only when the Crypto Operation is set to Hash Payload.

Parameter
Description
Data type
Supports DB
Default value

Payload

Field to directly inform the payload that will be hashed.

String

N/A

Algorithm-based configuration

These parameters depend on the selected Crypto Algorithm.

Parameter
Description
Data type
Supports DB
Default value

Account

Displayed only when Crypto Algorithm is one of HmacSHA1, HmacSHA256, HmacSHA384, or HmacSHA512. The account must be of the Secret Key type, and the key for the hash must be provided.

String

N/A

Secret Key (DB)

Displayed only if no account is selected and the Crypto Algorithm is one of HmacSHA1, HmacSHA256, HmacSHA384, or HmacSHA512. Allows the connector to receive the key dynamically.

String

N/A

Secret Key Type

Displayed only if no account is selected and the Crypto Algorithm is one of HmacSHA1, HmacSHA256, HmacSHA384, or HmacSHA512. Defines the type of key provided — String, Hexadecimal, or Base64.

Select

Hexadecimal

Charset

Displayed only when the Secret Key Type is String. Defines the character encoding of the key.

String

UTF-8

BCrypt Version

Displayed only when Crypto Algorithm is BCrypt. Defines the algorithm version to be used.

Select

2y

Salt

Displayed only when Crypto Algorithm is BCrypt. A 16-byte string added to the hash value. If not informed, a random value is assumed.

String

N/A

Cost Factor

Displayed only when Crypto Algorithm is BCrypt. Determines the number of hash rounds (2^n, where n is the cost factor, between 4 and 20).

Integer

4

Parameters additional information

Generated hash

The connector generates a hash from the string provided in the Payload field when the selected operation is Hash Payload.

If the selected operation is Hash Fields, the connector generates the hash from the string found in the fields specified in the input JSON.

Cost Factor

In the BCrypt algorithm, the cost factor exponentially increases the processing time and required resources. The algorithm is executed consecutively according to the number of rounds derived from the calculation 2ⁿ, where “n” is the cost factor.

The following examples illustrate how execution time can vary depending on the cost factor. The tests were performed using a 1 MB payload and the minimum and maximum allowed cost factor values for the BCrypt algorithm.

Cost Factor 4

  • Small pipeline: Average of 0.98s

  • Medium pipeline: Average of 0.64s

  • Large pipeline: Average of 0.07s

Cost Factor 20

  • Small pipeline: Average of 8m 7s

  • Medium pipeline: Average of 3m 56s

  • Large pipeline: Average of 1m 53s

These results may vary depending on the integration flow, message size, and cost factor applied.

The BCrypt cost factor can range from 4 to 31. However, values above 20 result in very high processing loads and execution times, often exceeding the pipeline timeout limits. For this reason, the Hash connector only accepts a maximum cost factor value of 20.

When using the BCrypt algorithm with the Hash connector, make sure to keep the cost factor within this limit to avoid validation or processing issues in your integration flow.

Message flow

Input

Operation: Hash Fields

When using the Hash Fields operation, the connector can receive any input message, but you must configure the JSON Field Path property to define where the hash will be applied. For example:

JSON Field Path: data.test

Payload:

{    
    "data":[
        {"test":"xpto"},        
        {"test":"xpto1"},        
        {"test":"xpto2"},        
        {"test":"xpto3"}    
    ]
}

In this case, the connector searches for the test property inside the data property.

Operation: Hash Payload

When using the Hash Payload operation, the message to be hashed must be provided in the Payload field.

Operation: Hash Files

When using the Hash Files operation, the file name must be provided in the File Name field.

Output

Operation: Hash Fields

The output maintains the same structure as the input but includes the generated hash.

If the Preserve Original property is enabled, the output keeps the original field and adds a new one prefixed with an underscore (_):

{
  "data": [
    {
      "test": "3851b1ae73ca0ca6e3c24a0256a80ace",
     "_test": "xpto"
    },
    {
      "test": "ca9e9bf198149d78f4aad334c838a263",
   "_test": "xpto1"
    },
    {
      "test": "83709b4f9067a83bbdfb0c358dc23a5e",
      "_test": "xpto2"
    },
    {
      "test": "e427f7e6f1bd29d91ea0cc53e40fba12",
      "_test": "xpto3"
    }
  ]
}

Operation: Hash Payload

The output contains the result property with the hash of the provided message:

{  
    "result": "3851b1ae73ca0ca6e3c24a0256a80ace"
}

Error example

{
  "success": false,
  "message": "Something went wrong while trying to use the HashConnector. Error: java.lang.StringIndexOutOfBoundsException: String index out of range: 1",
  "error": "java.lang.StringIndexOutOfBoundsException: String index out of range: 1"
}
  • success: false — indicates that an error occurred during execution.

  • message: connector error message.

  • error: detailed error message returned by the hash algorithm.

Operation: Hash Files

The output displays a result property containing the generated hash according to the selected algorithm.

Example using SHA-256:

{
  "result": "aff746225015b78af3c3f0a7540b10c300d73b3b562cec75ef2df9cfbf7ae2b6"
}

Hash in action

Operation: Hash Fields

Example 1

  • Crypto Operation: Hash Fields

  • Crypto Algorithm: SHA-256

  • JSON Field Path: data.test

  • Preserve Original: true

  • Result as Hexadecimal: true

Input

{
    "data": [
        {"test":"xpto"},
        {"test":"xpto1"},
        {"test":"xpto2"},
        {"test":"xpto3"}
    ]
}

Output

{
  "data": [
    {
      "test": "2e954593b0b51547656f7f06ec3818a2b42fed46307b81bd493133aa1ce45173",
      "_test": "xpto"
    },
    {
      "test": "8b948d95169f851545f8161fb4dc8e1d37a4c79014ac1d02186fa8946a91aab9",
      "_test": "xpto1"
    },
    {
      "test": "4c9e0d7ca22d9ab7cc675de59226f9477fd847ede13894b835d0ae204139f63a",
      "_test": "xpto2"
    },
    {
      "test": "b5bd5abe3eb5958153af6615df06ccbdfe5857a13da2601f49e4de9fbb102f9a",
      "_test": "xpto3"
    }
 ]
}

Example 2

  • Crypto Operation: Hash Fields

  • Crypto Algorithm: HmacSHA256

  • Account: (empty)

  • Secret Key: 001def0209

  • Secret Key Type: Hexadecimal (the value in the Secret Key field must be in hexadecimal format)

  • JSON Field Path: data.test

  • Preserve Original: true

  • Result as Hexadecimal: true

Input

{
    "data": [
        {"test":"xpto"},
        {"test":"xpto1"},
        {"test":"xpto2"},
        {"test":"xpto3"}
    ]
}

Output

{
  "data": [
    {
      "test": "257966929b29a6e0618d47a152e2856a888072400a5cb458fa1d40ff3cedc734",
      "_test": "xpto"
    },
    {
      "test": "ce0e754ab2f57f1fca1a00fce3e834a6940bea8013ae59b6641a4911e349b480",
      "_test": "xpto1"
    },
    {
      "test": "ff0cd9c0df219f99567aeb25d7d5ab9acff3c29728b0f4f71f50e750750a26d5",
      "_test": "xpto2"
    },
    {
      "test": "04a11cbc118ea455c0072e6c70607f68324e5444c8a4795443d25933d9dfa9c6",
      "_test": "xpto3"
    }
  ]
}

Example 3

  • Crypto Operation: Hash Fields

  • Crypto Algorithm: BCrypt

  • BCrypt Version: 2y

  • Salt: N9qo8uLOickgx2ZM

  • Cost: 6

  • JSON Field Path: data.test

  • Preserve Original: true

Input

{
    "data": [
        {"test":"xpto"},
        {"test":"xpto1"},
        {"test":"xpto2"},
        {"test":"xpto3"}
    ]
}

Output

{
    "data": [
        {
            "test": "$2y$06$RhjvZxfzRC7nW0rlcBHYROhJmATBMG6eXfkYkffexdfdFHzzp27Iu",
            "_test": "xpto"
        },
        {
            "test": "$2y$06$RhjvZxfzRC7nW0rlcBHYROm9TaJZ6QQUstIomnJG/Qgc7fPU5x8S.",
            "_test": "xpto1"
        },
        {
            "test": "$2y$06$RhjvZxfzRC7nW0rlcBHYROHAP1dIbNu3SenuQ6B.W9OkJ0/NzYF6e",
            "_test": "xpto2"
        },
        {
            "test": "$2y$06$RhjvZxfzRC7nW0rlcBHYROPsXkmxUVt8Suo8d3GuOl9q0pryw6iJy",
            "_test": "xpto3"
        }
    ]
}

Operation: Hash Payload

Example 1

  • Crypto Operation: Hash Payload

  • Crypto Algorithm: SHA-256

  • Payload: (any payload)

  • Result as Hexadecimal: true

Output

{  
    "result": "2e954593b0b51547656f7f06ec3818a2b42fed46307b81bd493133aa1ce45173"
}

Example 2

  • Crypto Operation: Hash Payload

  • Crypto Algorithm: HmacSHA512

  • Account: (empty)

  • Secret Key: 001def0209

  • Secret Key Type: Hexadecimal

  • Payload: (any payload)

  • Result as Hexadecimal: true

Output

{  
  "result": "517da9449385a43478309459adf9304bd3c8f63cd1d388abd5cbc02b81d8ccb39d303f877019aebfed073166e6c410197e10077f6df3f7a3b3f50adb8cd09580"
}

Example 3

  • Crypto Operation: Hash Payload

  • Crypto Algorithm: BCrypt

  • BCrypt Version: 2b

  • Salt: N9qo8uLOickgx2ZM

  • Cost: 10

  • Payload: {{ message.data }}

Input

{
    "data": [
        {"test":"xpto"},
        {"test":"xpto1"},
        {"test":"xpto2"},
        {"test":"xpto3"}
    ]
}

Output

{  
    "result": "$2b$10$RhjvZxfzRC7nW0rlcBHYROa3UXROXVeKZ3oK4DSc1mV6iJ/pBqBm6"
}

Operation: Hash Files

When you select the Hash Files operation, the connector generates a hash from the file provided in the File Name field.

The file must have been previously passed in the pipeline, for example, through a File Writer connector.

Example

  • Crypto Operation: Hash File

  • Crypto Algorithm: SHA-256

  • File Name: {{ message.fileName }} (the data is passed through the File Writer connector)

  • Result as Hexadecimal: true

Input

{
  "data": "linha 1",
  "fileName": "test"
}

Output

{
  "result": "aff746225015b78af3c3f0a7540b10c300d73b3b562cec75ef2df9cfbf7ae2b6"
}

Last updated

Was this helpful?