# Replace characters between two positions

This function masks all characters included in the defined interval, while the ones outside the interval are copied to the output as is.

| Option | Description |
| --- | --- |
| Method | The Randomly method<br>randomly selects a character. As a result, two identical input values can be<br>masked with different output values.<br><br>When the same value<br>appears twice in the input data, the Consistently method ensures that the function outputs the<br>same masked value in the same Job execution.<br><br>This function can encrypt the output masked<br>values in the same format as the input values, using Format-Preserving Encryption (FPE)<br>methods:<br><br><ul> <li> <span>FF1 with AES</span> relies on the                Advanced Encryption Standard in CBC mode.</li> <li> <span>FF1 with SHA-2</span> relies on the                secure hash function HMAC-256.</li> </ul><br><br>The FPE methods are bijective methods, except when<br>using tweaks.<br><br>The FF1 with<br>AES and FF1 with SHA-2 methods<br>require a password to generate encrypted and repeatable masked values. Those FPE methods<br>do not use a seed.<br><br>You can specify this password in the<br>password for FF1 method field, from the<br>Advanced Settings of the component. |
| Extra parameter | This function requires two extra parameters.<br><br>The<br>extra parameters must be numbers, which are the start and the end values of<br>the interval.<br><br>You can enter a third extra parameter,<br>which is the replacement character. |

In the first example, the first three characters are masked with the defined character.

In the second example, the replacement character is not defined. The second, third and fourth characters are masked with random characters.

| Input value | Method | Extra parameter | Example of a masked value |
| --- | --- | --- | --- |
| Jack | Randomly | "1,3,p" | pppk |
| S1000D | Randomly | "2,4" | S0640D |