MySQL Cryptographic Functions: Reference and Examples

MySQL Cryptographic Functions: Reference and Examples

Last updated:
Table of Contents

Sha2-512 Hash

As of this writing (Late 2020) 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.

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