Skip to main content
vsql_crypto brings a pgcrypto-compatible set of functions to MySQL, built on OpenSSL. It covers four jobs: hashing a value, signing a payload, encrypting a column, and storing a password you can verify later.

Install

vsql_crypto.veb is already in the server’s lib/veb/ directory if you installed VillageSQL with the install script, the Docker image, or a release tarball. Install it into the server with one statement:
Confirm it is there:
To build it yourself, follow the build instructions in the repository.

What it adds

The functions marked binary return raw bytes, so wrap them in HEX() to read them. The rest return text.

Example

Sign a payload and check the signature against a tampered copy:
Store a password. The result carries the algorithm, the iteration count, and the salt, so verification needs nothing else kept alongside it:
Your salt is random, so the hash differs on every call.
gen_salt supports the PBKDF2 family only. Asking for bf, md5, or des returns NULL, and crypt with a NULL salt returns NULL, so bcrypt hashes written by pgcrypto cannot be verified here.

See also