MySQL Encryption and Compression Functions
MySQL Encryption and Compression Functions
com/mysql-encryption-compression-functions/
MD5
Overview: MD5 is a widely used cryptographic hash function that produces
a 128-bit hash value (32 characters) from any input data. While MD5 is no
longer considered secure for cryptographic purposes due to vulnerabilities
that allow collision attacks, it is still used for non-cryptographic purposes like
checksums or quick data integrity checks.
Usage in MySQL: In MySQL, MD5 can be used to hash passwords or
sensitive information before storing them in the database. For example:
SELECT MD5('my_password');
SHA2
Overview: SHA2 is a family of cryptographic hash functions that includes
various hash lengths, such as SHA-224, SHA-256, SHA-384, SHA-512, and
others. SHA2 is considered more secure than MD5 and SHA-1, which have
known vulnerabilities.
Usage in MySQL: MySQL supports SHA2 as a hashing algorithm. For
example, to hash a password using SHA256:
SELECT COMPRESS('large_text_data');