random_hash

NAME

random_hash(): Return a random hash code.

TYPE

Function

DESCRIPTION

This function generates a 40 hexadecimal characters long random hash code.

The function relies on the SHA1() digest function.

To provide diverse and large input, the function uses random values, time stamp and global status data.

SYNOPSIS

random_hash()
  RETURNS CHAR(40) CHARSET ascii

EXAMPLES

Generate a random hash:

mysql> select random_hash() as hash;
+------------------------------------------+
| hash                                     |
+------------------------------------------+
| af89717a0a8d02830db8d172f3e35530e009b131 |
+------------------------------------------+

ENVIRONMENT

MySQL 5.1 or newer

SEE ALSO

crc64(), query_checksum()

AUTHOR

Shlomi Noach
 
common_schema documentation