HashIds with MariaDB

82 Views Asked by At

Is there any implementention of HashIds with Maria DB similar to the PostgreSQL implementation that would allow to manage encode and decode directly from the database ? I couldn't find any mention on the official website.

Thanks for any feedback or idea.
Adam.

1

There are 1 best solutions below

3
Georg Richter On

I am assuming that by Hashid you mean a function that converts long integers into a HASH, which is mainly used to make primary keys inaccessible to the user (For example YT movie ids).

MariaDB doesn't have a native function for, but it is possible to extend MariaDB with a user defined function written in C, which for example uses the hashid library.

Another alternative would be to hash/unhash the integer inside your client application. Depending on the programming language there are a lot of libraries available.

Also Postgres doesn't have a native hashid function, it's a 3rd party extension/user defined function.