Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uuid v5 in Postgres

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?

like image 626
Alex Rothberg Avatar asked May 23 '26 13:05

Alex Rothberg


1 Answers

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.

like image 89
Łukasz Kamiński Avatar answered May 25 '26 05:05

Łukasz Kamiński



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!