SHA(string)

Description: Returns an SHA1 (Secure Hash Algorithm) 160-bit checksum for the given string. Similar to MD5(), but cryptographically more secure. Introduced in MySQL 4.0.2.

Example:

  • SHA('secret message') returns '4dea808c5b4e74af6f70fa10cec96d5f98e143e8'.

See also: MD5()

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.