MySQL SHA1() function
SHA1() function
MySQL sha1() function calculates an SHA-1 160-bit checksum for a string.
The function returns a value as a binary string of 40 hex digits. If the string supplied as the argument is NULL, the function returns NULL.
Syntax:
SHA1(str)
Argument:
Name | Description |
---|---|
str | A string. |
Syntax Diagram:

MySQL Version: 5.6
Example:
Code:
SELECT SHA1('w3resource');
Explanation:
The above MySQL statement returns SHA1 checksum of w3resouce string. The return value is d228359c41174cede6b3c401eb8d11746a4ad1eb.
Sample Output:
mysql> SELECT SHA1('w3resource'); +------------------------------------------+ | SHA1('w3resource') | +------------------------------------------+ | d228359c41174cede6b3c401eb8d11746a4ad1eb | +------------------------------------------+ 1 row in set (0.00 sec)
Previous: PASSWORD()
Next:
UNCOMPRESS()
- Weekly Trends
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
- JavaScript functions Exercises
- Python Tutorial
- Python Array Exercises
- SQL Cross Join
- C# Sharp Array Exercises
We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook