2

I'm using django for a web-magazine with subscriber-content. when a user purchases a subscription, the site will create a validation key, and send it to the user email address. The validation key would be added to a list of "valid keys" until it is used.

What is the best method for creating a simple yet unique key? Can someone suggest a standard python library for key-creation/validation/ect?

This might be a very simple question, but I'm very new. ;)

Cody Django
  • 786
  • 8
  • 22

3 Answers3

2

I'd recommend using a GUID. They are quickly becoming industry standard for this kind of thing.

See how to create them here: How to create a GUID/UUID in Python

Community
  • 1
  • 1
Spencer Ruport
  • 34,865
  • 12
  • 85
  • 147
2

As other posters mentioned, you are looking for a GUID, of which the most popular implemntation UUID (see here) . Django extensions (see here) offer a UUID field just for this purpose.

Todd Gardner
  • 13,313
  • 39
  • 51
0

Well, you can always use a GUID. As you said it would be stored as a valid key.

Paulo Santos
  • 11,285
  • 4
  • 39
  • 65