/
random_hash.html
43 lines (37 loc) · 1.08 KB
/
random_hash.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<h3>NAME</h3>
random_hash(): Return a random hash code.
<h3>TYPE</h3>
Function
<h3>DESCRIPTION</h3>
<p>
This function generates a 40 hexadecimal characters long random hash code.
</p>
<p>
The function relies on the <a href="https://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html#function_sha1">SHA1()</a> digest function.
</p>
<p>
To provide diverse and large input, the function uses random values, time stamp and global status data.
</p>
<h3>SYNOPSIS</h3>
<p>
<blockquote><pre>random_hash()
RETURNS CHAR(40) CHARSET ascii</pre></blockquote>
</p>
<h3>EXAMPLES</h3>
<p>
Generate a random hash:
</p>
<blockquote><pre>mysql> select random_hash() as hash;
+------------------------------------------+
| hash |
+------------------------------------------+
| af89717a0a8d02830db8d172f3e35530e009b131 |
+------------------------------------------+
</pre></blockquote>
<h3>ENVIRONMENT</h3>
MySQL 5.1 or newer
<h3>SEE ALSO</h3>
<a href="crc64.html">crc64()</a>,
<a href="query_checksum.html">query_checksum()</a>
<h3>AUTHOR</h3>
Shlomi Noach