6

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?

Alex Rothberg
  • 10,243
  • 13
  • 60
  • 120

1 Answers1

6

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.

Community
  • 1
  • 1
Łukasz Kamiński
  • 5,630
  • 1
  • 19
  • 32