uuid v5 in Postgres

3.7k Views Asked by At

Does Postgres (or a Postgres extension) have a uuid v5 function (ie one that takes in a UUID name space and a string to produce a new UUID)?

If not a native function, how would one write this function?

1

There are 1 best solutions below

0
On

Yes, uuid-ossp module provides such function.

uuid_generate_v5(namespace uuid, name text)

This function generates a version 5 UUID, which works like a version 3 UUID except that SHA-1 is used as a hashing method. Version 5 should be preferred over version 3 because SHA-1 is thought to be more secure than MD5.