Reading time:

Implementing a blake3 hash plugin for MySQL in Rust

It's been long since I've written something, I wanted to bring you some new stuff, so here you have a short blog post. I encourage you to try this new plugin that uses this blake3 hash implementation. Blake3 is secure, unlike MD5 and SHA-1. And secure against length extension, unlike SHA-2. Start using it and create an issue in the github repo if you would like a feature implemented!

Checkout blake-udf source code.

How to use

Download and install MySQL plugin

$ wget 'https://github.com/mliezun/blake-udf/releases/download/v0.1.0/libblake_udf.so'
$ mv libblake_udf.so /usr/lib/mysql/plugin/

Load UDF in MySQL

$ mysql -uroot -p -e 'create function blake3_hash returns string soname "libblake_udf.so";'

Execute function

$ mysql --binary-as-hex=0 -uroot -p -e 'select blake3_hash("a");'
Output: 17762fddd969a453925d65717ac3eea21320b66b54342fde15128d6caf21215f