The HASH function uses a user-specified algorithm to return the hash value of a RAW or CLOB value. The HASH function is available in three forms:

HASH
  (<src> IN RAW, <typ> IN INTEGER) RETURN RAW

HASH
  (<src> IN CLOB, <typ> IN INTEGER) RETURN RAW

Parameters

src

src specifies the value for which the hash value will be generated. You can specify a RAW, a BLOB, or a CLOB value.

typ

typ specifies the HASH function type. Advanced Server supports the HASH function types listed below:

HASH Functions
HASH_MD4CONSTANT INTEGER := 1;
HASH_MD5CONSTANT INTEGER := 2;
HASH_SH1CONSTANT INTEGER := 3;

Examples

The following example uses DBMS_CRYPTO.HASH to find the md5 hash value of the string, cleartext source:

DECLARE
  typ INTEGER := DBMS_CRYPTO.HASH_MD5;
  hash_value RAW(100);
BEGIN

  hash_value := DBMS_CRYPTO.HASH('cleartext source', typ);

END;