Skip to content

Latest commit

 

History

History
43 lines (35 loc) · 5.13 KB

encryption-and-compression-functions.md

File metadata and controls

43 lines (35 loc) · 5.13 KB
title summary aliases
Encryption and Compression Functions
Learn about the encryption and compression functions.
/docs/dev/functions-and-operators/encryption-and-compression-functions/
/docs/dev/reference/sql/functions-and-operators/encryption-and-compression-functions/

Encryption and Compression Functions

TiDB supports most of the encryption and compression functions available in MySQL 5.7.

Supported functions

Name Description
MD5() Calculate MD5 checksum
PASSWORD() Calculate and return a password string
RANDOM_BYTES() Return a random byte vector
SHA1(), SHA() Calculate an SHA-1 160-bit checksum
SHA2() Calculate an SHA-2 checksum
AES_DECRYPT() Decrypt using AES
AES_ENCRYPT() Encrypt using AES
COMPRESS() Return result as a binary string
UNCOMPRESS() Uncompress a string compressed
UNCOMPRESSED_LENGTH() Return the length of a string before compression
CREATE_ASYMMETRIC_PRIV_KEY() Create private key
CREATE_ASYMMETRIC_PUB_KEY() Create public key
CREATE_DH_PARAMETERS() Generate shared DH secret
CREATE_DIGEST() Generate digest from string
ASYMMETRIC_DECRYPT() Decrypt ciphertext using private or public key
ASYMMETRIC_DERIVE() Derive symmetric key from asymmetric keys
ASYMMETRIC_ENCRYPT() Encrypt cleartext using private or public key
ASYMMETRIC_SIGN() Generate signature from digest
ASYMMETRIC_VERIFY() Verify that signature matches digest

Related system variables

The block_encryption_mode variable sets the encryption mode that is used for AES_ENCRYPT() and AES_DECRYPT().

Unsupported functions

  • DES_DECRYPT(), DES_ENCRYPT(), OLD_PASSWORD(), ENCRYPT(): these functions were deprecated in MySQL 5.7 and removed in 8.0.
  • VALIDATE_PASSWORD_STRENGTH()
  • Functions only available in MySQL Enterprise Issue #2632