MySQL Cryptographic Functions: Reference and Examples

Last updated:
Table of Contents

WIP Alert This is a work in progress. Current information is correct but more content may be added in the future.

Hash using sha2-512

As of this writing (Mid 2019) it's still secure to use this function and 512 bits should suffice.

Hash sensitive information using MySQL sha2(string,512) function.

It digests (i.e. summarizes) strings of any size into a base-64 string, having 512 bits in length.

Apparently, this feature was added in MySQL version 5.5.5. (Official Documentation for MySQL encryption functions)[http://dev.mysql.com/doc/refman/5.6/en/encryption-functions.html].

INSERT INTO testing_table(id, name) VALUES (null,sha2('foo',512))

Dialogue & Discussion