Security algorithms
Security algorithms protect sensitive data, such as names, account numbers, and phone numbers, using methods such as hashing, masking, and encryption and decryption. These methods desensitize data while preserving its original format. This topic describes how to view and test the built-in security algorithms in Dataphin.
View security algorithms
-
On the Dataphin homepage, choose Governance > Data Security from the top menu bar.
-
In the left-side navigation pane, choose General Settings > Security Algorithm to open the Security Algorithm page.
Parameter
Description
Algorithm name
The name of the security algorithm.
Algorithm type
The type of the security algorithm.
Description
The description of the security algorithm.
Desensitization example
An example of how the security algorithm desensitizes data.
Implementation method
There are two implementation methods: built-in database function and security policy-based algorithm package.
-
Built-in database function: Desensitizes data using the database's built-in functions. You do not need to install an algorithm package in the task's project. However, some advanced desensitization methods are not supported.
-
Security policy-based algorithm package: Uses Dataphin's built-in algorithm packages for desensitization or encryption and decryption. This method requires you to enable the security policy and install the algorithm package in the task's project. Otherwise, Dataphin applies the default masking policy.
Corresponding function/algorithm
This algorithm requires you to install the corresponding security policy-based algorithm package in the task's project.
Scope and prerequisites
Lists the supported compute engines, data source types, and prerequisites for the algorithm.
-
Algorithm package · installable: Requires you to install an asset security policy in the project. This method is suitable for complex desensitization logic, custom encryption algorithms, and advanced privacy protection strategies.
-
Built-in function · installation-free: Uses the native functions of the compute engine and requires no extra installation. This method is suitable for standard desensitization rules, such as masking and hashing, and for routine data cleaning.
NoteSecurity algorithms desensitize data using the built-in functions of their respective compute engines. You cannot directly install algorithm packages or plug-ins on data sources.
-
Security algorithms
The Security Algorithm page lists the algorithms built into Dataphin, including hash, masking, and encryption and decryption algorithms. You can view a brief description for each algorithm or select one to test. For instructions on testing, see Test security algorithms.

To learn how to use an algorithm, click Description and follow these steps:
-
Install an asset security policy: Masking algorithms are security functions within a project. Some compute engines require you to install an asset security policy to desensitize data, while others can use their built-in functions. For more information, see Project security policy and Desensitization methods supported by different engines.
NoteIf you use a compute engine's built-in functions, you do not need to install an algorithm package. Examples include projects using AnalyticDB for PostgreSQL and Hologres.
-
Select an algorithm: Choose an algorithm based on your scenario. To desensitize sensitive data for viewing, you can select a masking or hashing algorithm. To encrypt data for storage and transmission where you need to retrieve the original value later, use a symmetric or asymmetric encryption algorithm. For more information about different security algorithms, see Security algorithm description.
-
Register a key: For algorithms that require a key, such as symmetric encryption algorithms, you must first register the key in Key Management. For more information, see Key management.
-
Reference a function: You can reference a security function in your SQL statements when you write data processing scripts or run ad-hoc queries in the development module. You can also select a security function when you configure desensitization rules.
Test security algorithms
-
On the Security Algorithm page, click Test in the Actions column for the target algorithm.
-
In the Test Security Algorithm dialog box, enter the content to test.
For example, to test a name masking algorithm, enter a name like
Johnin the Content to be desensitized field and click the arrow icon
. The Output Value field then shows *ohn.
Example for a native DES encryption algorithm: Configure the following parameters.
-
Plaintext: The input length must be a multiple of 8 bytes.
-
Key: When you use this algorithm in an integration task, you can use a system-managed key without entering the key value to ensure key security. When you use this algorithm in a code-based task, you must enter the key value directly. For enhanced security, you can use a global variable of the Account and Password type to store the key. The key must be an 8-character alphanumeric string.
-
Encryption mode: You can select one of five modes: ECB, CBC, CFB, CTR, or OFB. The same encryption mode must be used for both encryption and decryption. For more information about encryption and decryption algorithms, see Security algorithm examples.
-
Padding: You can select NoPadding, PKCS5Padding, or PKCS7Padding. The same padding scheme must be used for both encryption and decryption.
-
Initialization Vector (also known as IV): Encrypting the same plaintext with different IVs produces different ciphertext. The IV must be an 8-digit number. The same IV must be used for both encryption and decryption.
-
Encoding format: To ensure that ciphertext can be safely transmitted, stored, and displayed across different environments, binary data must be converted to a text-based representation. During decryption, this encoded ciphertext must be decoded back to binary data before the decryption can proceed. Supported formats include Base64 and Hex.
Click the arrow icon
to view the output value.
-
-
If the test result is as expected, click Close.