If that is the case I'd suggest using a hash to encode your username with a "salt" that you only know, for example:
import hashlib salt = "my secret passphrase" hash_info = hashlib.sha256('%s%s' % (username, salt)).hexdigest() Under this scenario, assuming that usernames are unique, for user "john" the hashed URL "part" would be: print hash_info '4c481672be4c3c245ad47ebcdf8cb48330fd18b70117a5353db8fe0841ab8dee' So you can now compare the hashed entry to the user and see if it a valid one. There are many ways to go about doing this, this is just an example, of course, Cheers Julio On Apr 29, 11:07 am, Jason Brower <encomp...@gmail.com> wrote: > Great ideas! > Could putting the users ID athe beginning or end be a good idea? Is it > in some way hackable? I wouldn't use it to identifiy the users id with > it, but I would be able to garontee an individual string with out to > much work. :D > BR, > Jason > > On 04/29/2011 07:30 PM, Massimo Di Pierro wrote: > > > > > > > > > One trick... try avoid having 'l 1' and '0 o O' because depending on > > the font you use they can be confused. It may also be a good idea to > > only use upper case and numbers. > > > chars = 'ABCDEFGHIJKLMNPQRSTUVWXYZ12345678" or > > > chars = 'abcdefghijkmnpqrstuvwxyz23456789" > > > and > > > ''.join(random.choice(chars) for letter in xrange(8)) > > > On Apr 29, 11:07 am, Julio Schwarzbeck<ju...@techfuel.net> wrote: > >> Try this: > > >> import random > >> import string > >> print ''.join(random.choice(string.ascii_letters + string.digits) for > >> letter in xrange(8)) > > >> Output: > > >>>>> print ''.join(random.choice(string.ascii_letters + string.digits) for > >>>>> letter in xrange(8)) > >> MRWFo6Fv > >>>>> print ''.join(random.choice(string.ascii_letters + string.digits) for > >>>>> letter in xrange(8)) > >> yiHlYvFj > >>>>> print ''.join(random.choice(string.ascii_letters + string.digits) for > >>>>> letter in xrange(8)) > >> ugYaozlO > > >> Obviously since the "sample" is so small there is a (rather large) > >> probability that you could get dupes, I'd suggest you increase the > >> length of your string in any case. > > >> Cheers. > > >> julio > > >> On Apr 29, 8:29 am, Jason Brower<encomp...@gmail.com> wrote: > > >>> I want to make a unique set of chars that people can't just figure out > >>> what they are for. The reason for this is to create unique barcodes for > >>> ticket validation when entiring a conference using my software. This > >>> unique letter numb combo would be in a 2d barcode and it entered using a > >>> restful interface. > >>> I am hoping ticket validation would be with an 8 digit string and > >>> nametags would use something similar for their individual identification > >>> with a 4 digit string. Both will be turned into datamatrix codes that > >>> will be appended to web addresses. For example,http://iid.me/A123a567 > >>> orhttp://iid.me/9F4donewouldbe for validating the ticket, the other > >>> would be for various perposed depending on who uses it. > >>> Best Regards, > >>> Jason Brower