The one-way HASH function converts a variable-length input string to a string with a fixed length (usually small), which is called a hash value. The hash value is the unique identifier (such as a fingerprint) of the input data. You can use the hash value to verify whether the data has been modified.
It is easy to calculate the hash value of the input data but difficult to generate certain data based on a hash value. Therefore, the one-way HASH function can effectively ensure data integrity.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
Syntax
DBMS_CRYPTO.Hash (
src IN RAW,
typ IN PLS_INTEGER)
RETURN RAW;
DBMS_CRYPTO.Hash (
src IN BLOB,
typ IN PLS_INTEGER)
RETURN RAW;
DBMS_CRYPTO.Hash (
src IN CLOB CHARACTER SET ANY_CS,
typ IN PLS_INTEGER)
RETURN RAW;
Parameters
| Parameter | Description |
|---|---|
| src | The source data to be hashed. |
| typ | The hash algorithm to be used. |
Considerations
We recommend that you use the SHA-1 or SHA-2 hash algorithm, because they can better defend against brute-force attacks compared with MD4 or MD5. If a message digest algorithm must be used, MD5 provides higher security than MD4.