I would like every node created to have a unique ID. What's the best way to go about this? I know of the UUID module, but I don't really want the IDs to be formatted like a UUID. Does there exist a module that creates a unique ID that looks like (for example) an md5 hash?

The reason for doing this is that information about certain nodes has to be passed around between a few servers (in emails in some cases) and I don't wan't people to be able to have access to the drupal server's systems, I'd rather them see something like a hash as opposed to drupal's nid.

1 Answer 1


Interesting question. Here's how I'd do it.

  1. Use Custom Tokens to create a custom token that runs the nid through md5();.

  2. Use that custom token in Pathauto.

  • depending on how you are passing things around, and given that the nid is never going to change, unless you have performance concerns about running md5() often, this could easily be done on the fly, too, without any need for either of the modules above. (holy run on comment batman!)
    – Jimajamma
    Aug 1, 2012 at 13:55
  • Hrm, I don't think I was specific enough. The unique ID doesn't need to be used to access the node from a browser, it will end up being used by an EntityFieldQuery to load the node it refers to. The issue is, that there's a potential for a random person to see the node ID being passed to the entityQuery (hence why I want to use a unique random identifier). I've been looking into hook_node_insert to add a custom field as soon as a node is created. Aug 2, 2012 at 1:24
  • @CameronBall It's not that a random person would see the node ID being passed to the query. Plus, there isn't any security involved, in knowing the node ID.
    – apaderno
    Aug 30, 2012 at 1:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.